<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><link rel="stylesheet" type="text/css" href="style.css" /><script type="text/javascript" src="highlight.js"></script></head><body><pre><span class="hs-pragma">{-# LANGUAGE CPP #-}</span><span>
</span><span id="line-2"></span><span class="hs-pragma">{-# LANGUAGE ViewPatterns #-}</span><span>
</span><span id="line-3"></span><span class="hs-pragma">{-# LANGUAGE TypeFamilies #-}</span><span>
</span><span id="line-4"></span><span>
</span><span id="line-5"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-6"></span><span class="hs-comment">--</span><span>
</span><span id="line-7"></span><span class="hs-comment">-- | Parsing the top of a Haskell source file to get its module name,</span><span>
</span><span id="line-8"></span><span class="hs-comment">-- imports and options.</span><span>
</span><span id="line-9"></span><span class="hs-comment">--</span><span>
</span><span id="line-10"></span><span class="hs-comment">-- (c) Simon Marlow 2005</span><span>
</span><span id="line-11"></span><span class="hs-comment">-- (c) Lemmih 2006</span><span>
</span><span id="line-12"></span><span class="hs-comment">--</span><span>
</span><span id="line-13"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-14"></span><span>
</span><span id="line-15"></span><span class="hs-keyword">module</span><span> </span><span class="hs-identifier">GHC.Parser.Header</span><span>
</span><span id="line-16"></span><span>   </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Parser.Header.html#getImports"><span class="hs-identifier">getImports</span></a></span><span>
</span><span id="line-17"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Parser.Header.html#mkPrelImports"><span class="hs-identifier">mkPrelImports</span></a></span><span> </span><span class="hs-comment">-- used by the renamer too</span><span>
</span><span id="line-18"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Parser.Header.html#getOptionsFromFile"><span class="hs-identifier">getOptionsFromFile</span></a></span><span>
</span><span id="line-19"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Parser.Header.html#getOptions"><span class="hs-identifier">getOptions</span></a></span><span>
</span><span id="line-20"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Parser.Header.html#optionsErrorMsgs"><span class="hs-identifier">optionsErrorMsgs</span></a></span><span>
</span><span id="line-21"></span><span>   </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Parser.Header.html#checkProcessArgsResult"><span class="hs-identifier">checkProcessArgsResult</span></a></span><span>
</span><span id="line-22"></span><span>   </span><span class="hs-special">)</span><span>
</span><span id="line-23"></span><span class="hs-keyword">where</span><span class="hs-cpp">

#include &quot;HsVersions.h&quot;
</span><span>
</span><span id="line-27"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Prelude.html"><span class="hs-identifier">GHC.Prelude</span></a></span><span>
</span><span id="line-28"></span><span>
</span><span id="line-29"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.Platform.html#"><span class="hs-identifier">GHC.Platform</span></a></span><span>
</span><span id="line-30"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Types.html"><span class="hs-identifier">GHC.Driver.Types</span></a></span><span>
</span><span id="line-31"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Parser.html"><span class="hs-identifier">GHC.Parser</span></a></span><span>           </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Parser.html#parseHeader"><span class="hs-identifier">parseHeader</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-32"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html"><span class="hs-identifier">GHC.Parser.Lexer</span></a></span><span>
</span><span id="line-33"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.FastString.html"><span class="hs-identifier">GHC.Data.FastString</span></a></span><span>
</span><span id="line-34"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Hs.html"><span class="hs-identifier">GHC.Hs</span></a></span><span>
</span><span id="line-35"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Unit.Module.html"><span class="hs-identifier">GHC.Unit.Module</span></a></span><span>
</span><span id="line-36"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Builtin.Names.html"><span class="hs-identifier">GHC.Builtin.Names</span></a></span><span>
</span><span id="line-37"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.StringBuffer.html"><span class="hs-identifier">GHC.Data.StringBuffer</span></a></span><span>
</span><span id="line-38"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html"><span class="hs-identifier">GHC.Types.SrcLoc</span></a></span><span>
</span><span id="line-39"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html"><span class="hs-identifier">GHC.Driver.Session</span></a></span><span>
</span><span id="line-40"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html"><span class="hs-identifier">GHC.Utils.Error</span></a></span><span>
</span><span id="line-41"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Misc.html"><span class="hs-identifier">GHC.Utils.Misc</span></a></span><span>
</span><span id="line-42"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html"><span class="hs-identifier">GHC.Utils.Outputable</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Outputable</span></span><span>
</span><span id="line-43"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Maybe.html"><span class="hs-identifier">GHC.Data.Maybe</span></a></span><span>
</span><span id="line-44"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html"><span class="hs-identifier">GHC.Data.Bag</span></a></span><span>         </span><span class="hs-special">(</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier">emptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier">listToBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier">unitBag</span></a></span><span> </span><span class="hs-special">)</span><span>
</span><span id="line-45"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Monad.html"><span class="hs-identifier">GHC.Utils.Monad</span></a></span><span>
</span><span id="line-46"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Utils.Exception.html"><span class="hs-identifier">GHC.Utils.Exception</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">Exception</span></span><span>
</span><span id="line-47"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="GHC.Types.Basic.html"><span class="hs-identifier">GHC.Types.Basic</span></a></span><span>
</span><span id="line-48"></span><span class="hs-keyword">import</span><span> </span><span class="hs-keyword">qualified</span><span> </span><span class="annot"><a href="../../ghc-boot/src/GHC.LanguageExtensions.html#"><span class="hs-identifier">GHC.LanguageExtensions</span></a></span><span> </span><span class="hs-keyword">as</span><span> </span><span class="annot"><span class="hs-identifier">LangExt</span></span><span>
</span><span id="line-49"></span><span>
</span><span id="line-50"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.html#"><span class="hs-identifier">Control.Monad</span></a></span><span>
</span><span id="line-51"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.html#"><span class="hs-identifier">System.IO</span></a></span><span>
</span><span id="line-52"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/System.IO.Unsafe.html#"><span class="hs-identifier">System.IO.Unsafe</span></a></span><span>
</span><span id="line-53"></span><span class="hs-keyword">import</span><span> </span><span class="annot"><a href="../../base/src/Data.List.html#"><span class="hs-identifier">Data.List</span></a></span><span>
</span><span id="line-54"></span><span>
</span><span id="line-55"></span><span class="hs-comment">------------------------------------------------------------------------------</span><span>
</span><span id="line-56"></span><span>
</span><span id="line-57"></span><span class="hs-comment">-- | Parse the imports of a source file.</span><span>
</span><span id="line-58"></span><span class="hs-comment">--</span><span>
</span><span id="line-59"></span><span class="hs-comment">-- Throws a 'SourceError' if parsing fails.</span><span>
</span><span id="line-60"></span><span class="annot"><a href="GHC.Parser.Header.html#getImports"><span class="hs-identifier hs-type">getImports</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-61"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.StringBuffer.html#StringBuffer"><span class="hs-identifier hs-type">StringBuffer</span></a></span><span> </span><span class="hs-comment">-- ^ Parse this.</span><span>
</span><span id="line-62"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>     </span><span class="hs-comment">-- ^ Filename the buffer came from.  Used for</span><span>
</span><span id="line-63"></span><span>                           </span><span class="hs-comment">--   reporting parse error locations.</span><span>
</span><span id="line-64"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>     </span><span class="hs-comment">-- ^ The original source filename (used for locations</span><span>
</span><span id="line-65"></span><span>                           </span><span class="hs-comment">--   in the function result)</span><span>
</span><span id="line-66"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/Data.Either.html#Either"><span class="hs-identifier hs-type">Either</span></a></span><span>
</span><span id="line-67"></span><span>               </span><span class="annot"><a href="GHC.Utils.Error.html#ErrorMessages"><span class="hs-identifier hs-type">ErrorMessages</span></a></span><span>
</span><span id="line-68"></span><span>               </span><span class="hs-special">(</span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#FastString"><span class="hs-identifier hs-type">FastString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-69"></span><span>                </span><span class="hs-special">[</span><span class="hs-special">(</span><span class="annot"><a href="../../base/src/GHC.Maybe.html#Maybe"><span class="hs-identifier hs-type">Maybe</span></a></span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#FastString"><span class="hs-identifier hs-type">FastString</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span class="hs-special">)</span><span class="hs-special">]</span><span class="hs-special">,</span><span>
</span><span id="line-70"></span><span>                </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-71"></span><span>              </span><span class="hs-comment">-- ^ The source imports and normal imports (with optional package</span><span>
</span><span id="line-72"></span><span>              </span><span class="hs-comment">-- names from -XPackageImports), and the module name.</span><span>
</span><span id="line-73"></span><span id="getImports"><span class="annot"><span class="annottext">getImports :: DynFlags
-&gt; StringBuffer
-&gt; String
-&gt; String
-&gt; IO
     (Either
        ErrorMessages
        ([(Maybe FastString, Located ModuleName)],
         [(Maybe FastString, Located ModuleName)], Located ModuleName))
</span><a href="GHC.Parser.Header.html#getImports"><span class="hs-identifier hs-var hs-var">getImports</span></a></span></span><span> </span><span id="local-6989586621680995148"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995148"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680995147"><span class="annot"><span class="annottext">StringBuffer
</span><a href="#local-6989586621680995147"><span class="hs-identifier hs-var">buf</span></a></span></span><span> </span><span id="local-6989586621680995146"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680995146"><span class="hs-identifier hs-var">filename</span></a></span></span><span> </span><span id="local-6989586621680995145"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680995145"><span class="hs-identifier hs-var">source_filename</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-74"></span><span>  </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680995144"><span class="annot"><span class="annottext">loc :: RealSrcLoc
</span><a href="#local-6989586621680995144"><span class="hs-identifier hs-var hs-var">loc</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Int -&gt; Int -&gt; RealSrcLoc
</span><a href="GHC.Types.SrcLoc.html#mkRealSrcLoc"><span class="hs-identifier hs-var">mkRealSrcLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#mkFastString"><span class="hs-identifier hs-var">mkFastString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680995146"><span class="hs-identifier hs-var">filename</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-75"></span><span>  </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">P (Located HsModule) -&gt; PState -&gt; ParseResult (Located HsModule)
forall a. P a -&gt; PState -&gt; ParseResult a
</span><a href="GHC.Parser.Lexer.html#unP"><span class="hs-identifier hs-var hs-var">unP</span></a></span><span> </span><span class="annot"><span class="annottext">P (Located HsModule)
</span><a href="GHC.Parser.html#parseHeader"><span class="hs-identifier hs-var">parseHeader</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; StringBuffer -&gt; RealSrcLoc -&gt; PState
</span><a href="GHC.Parser.Lexer.html#mkPState"><span class="hs-identifier hs-var">mkPState</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995148"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">StringBuffer
</span><a href="#local-6989586621680995147"><span class="hs-identifier hs-var">buf</span></a></span><span> </span><span class="annot"><span class="annottext">RealSrcLoc
</span><a href="#local-6989586621680995144"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-76"></span><span>    </span><span class="annot"><a href="GHC.Parser.Lexer.html#PFailed"><span class="hs-identifier hs-type">PFailed</span></a></span><span> </span><span id="local-6989586621680995138"><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995138"><span class="hs-identifier hs-var">pst</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span>
</span><span id="line-77"></span><span>        </span><span class="hs-comment">-- assuming we're not logging warnings here as per below</span><span>
</span><span id="line-78"></span><span>      </span><span class="annot"><span class="annottext">Either
  ErrorMessages
  ([(Maybe FastString, Located ModuleName)],
   [(Maybe FastString, Located ModuleName)], Located ModuleName)
-&gt; IO
     (Either
        ErrorMessages
        ([(Maybe FastString, Located ModuleName)],
         [(Maybe FastString, Located ModuleName)], Located ModuleName))
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">(Either
   ErrorMessages
   ([(Maybe FastString, Located ModuleName)],
    [(Maybe FastString, Located ModuleName)], Located ModuleName)
 -&gt; IO
      (Either
         ErrorMessages
         ([(Maybe FastString, Located ModuleName)],
          [(Maybe FastString, Located ModuleName)], Located ModuleName)))
-&gt; Either
     ErrorMessages
     ([(Maybe FastString, Located ModuleName)],
      [(Maybe FastString, Located ModuleName)], Located ModuleName)
-&gt; IO
     (Either
        ErrorMessages
        ([(Maybe FastString, Located ModuleName)],
         [(Maybe FastString, Located ModuleName)], Located ModuleName))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ErrorMessages
-&gt; Either
     ErrorMessages
     ([(Maybe FastString, Located ModuleName)],
      [(Maybe FastString, Located ModuleName)], Located ModuleName)
forall a b. a -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-var">Left</span></a></span><span> </span><span class="annot"><span class="annottext">(ErrorMessages
 -&gt; Either
      ErrorMessages
      ([(Maybe FastString, Located ModuleName)],
       [(Maybe FastString, Located ModuleName)], Located ModuleName))
-&gt; ErrorMessages
-&gt; Either
     ErrorMessages
     ([(Maybe FastString, Located ModuleName)],
      [(Maybe FastString, Located ModuleName)], Located ModuleName)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">PState -&gt; DynFlags -&gt; ErrorMessages
</span><a href="GHC.Parser.Lexer.html#getErrorMessages"><span class="hs-identifier hs-var">getErrorMessages</span></a></span><span> </span><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995138"><span class="hs-identifier hs-var">pst</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995148"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-79"></span><span>    </span><span class="annot"><a href="GHC.Parser.Lexer.html#POk"><span class="hs-identifier hs-type">POk</span></a></span><span> </span><span id="local-6989586621680995135"><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995135"><span class="hs-identifier hs-var">pst</span></a></span></span><span> </span><span id="local-6989586621680995134"><span class="annot"><span class="annottext">Located HsModule
</span><a href="#local-6989586621680995134"><span class="hs-identifier hs-var">rdr_module</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(([(Maybe FastString, Located ModuleName)],
  [(Maybe FastString, Located ModuleName)], Located ModuleName)
 -&gt; Either
      ErrorMessages
      ([(Maybe FastString, Located ModuleName)],
       [(Maybe FastString, Located ModuleName)], Located ModuleName))
-&gt; IO
     ([(Maybe FastString, Located ModuleName)],
      [(Maybe FastString, Located ModuleName)], Located ModuleName)
-&gt; IO
     (Either
        ErrorMessages
        ([(Maybe FastString, Located ModuleName)],
         [(Maybe FastString, Located ModuleName)], Located ModuleName))
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">([(Maybe FastString, Located ModuleName)],
 [(Maybe FastString, Located ModuleName)], Located ModuleName)
-&gt; Either
     ErrorMessages
     ([(Maybe FastString, Located ModuleName)],
      [(Maybe FastString, Located ModuleName)], Located ModuleName)
forall a b. b -&gt; Either a b
</span><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-var">Right</span></a></span><span> </span><span class="annot"><span class="annottext">(IO
   ([(Maybe FastString, Located ModuleName)],
    [(Maybe FastString, Located ModuleName)], Located ModuleName)
 -&gt; IO
      (Either
         ErrorMessages
         ([(Maybe FastString, Located ModuleName)],
          [(Maybe FastString, Located ModuleName)], Located ModuleName)))
-&gt; IO
     ([(Maybe FastString, Located ModuleName)],
      [(Maybe FastString, Located ModuleName)], Located ModuleName)
-&gt; IO
     (Either
        ErrorMessages
        ([(Maybe FastString, Located ModuleName)],
         [(Maybe FastString, Located ModuleName)], Located ModuleName))
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-80"></span><span>      </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680995133"><span class="annot"><span class="annottext">_ms :: (ErrorMessages, ErrorMessages)
</span><a href="#local-6989586621680995133"><span class="hs-identifier hs-var">_ms</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span id="local-6989586621680995132"><span class="annot"><span class="annottext">ErrorMessages
</span><a href="#local-6989586621680995132"><span class="hs-identifier hs-var">_warns</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680995131"><span class="annot"><span class="annottext">ErrorMessages
</span><a href="#local-6989586621680995131"><span class="hs-identifier hs-var">errs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PState -&gt; DynFlags -&gt; (ErrorMessages, ErrorMessages)
</span><a href="GHC.Parser.Lexer.html#getMessages"><span class="hs-identifier hs-var">getMessages</span></a></span><span> </span><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995135"><span class="hs-identifier hs-var">pst</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995148"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-81"></span><span>      </span><span class="hs-comment">-- don't log warnings: they'll be reported when we parse the file</span><span>
</span><span id="line-82"></span><span>      </span><span class="hs-comment">-- for real.  See #2500.</span><span>
</span><span id="line-83"></span><span>          </span><span id="local-6989586621680995129"><span class="annot"><span class="annottext">ms :: (ErrorMessages, ErrorMessages)
</span><a href="#local-6989586621680995129"><span class="hs-identifier hs-var hs-var">ms</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ErrorMessages
forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var">emptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ErrorMessages
</span><a href="#local-6989586621680995131"><span class="hs-identifier hs-var">errs</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-84"></span><span>      </span><span class="hs-comment">-- logWarnings warns</span><span>
</span><span id="line-85"></span><span>      </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; (ErrorMessages, ErrorMessages) -&gt; Bool
</span><a href="GHC.Utils.Error.html#errorsFound"><span class="hs-identifier hs-var">errorsFound</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995148"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">(ErrorMessages, ErrorMessages)
</span><a href="#local-6989586621680995129"><span class="hs-identifier hs-var">ms</span></a></span><span>
</span><span id="line-86"></span><span>        </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">SourceError
-&gt; IO
     ([(Maybe FastString, Located ModuleName)],
      [(Maybe FastString, Located ModuleName)], Located ModuleName)
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">throwIO</span></a></span><span> </span><span class="annot"><span class="annottext">(SourceError
 -&gt; IO
      ([(Maybe FastString, Located ModuleName)],
       [(Maybe FastString, Located ModuleName)], Located ModuleName))
-&gt; SourceError
-&gt; IO
     ([(Maybe FastString, Located ModuleName)],
      [(Maybe FastString, Located ModuleName)], Located ModuleName)
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ErrorMessages -&gt; SourceError
</span><a href="GHC.Driver.Types.html#mkSrcErr"><span class="hs-identifier hs-var">mkSrcErr</span></a></span><span> </span><span class="annot"><span class="annottext">ErrorMessages
</span><a href="#local-6989586621680995131"><span class="hs-identifier hs-var">errs</span></a></span><span>
</span><span id="line-87"></span><span>        </span><span class="hs-keyword">else</span><span>
</span><span id="line-88"></span><span>          </span><span class="hs-keyword">let</span><span>   </span><span id="local-6989586621680995125"><span class="annot"><span class="annottext">hsmod :: HsModule
</span><a href="#local-6989586621680995125"><span class="hs-identifier hs-var hs-var">hsmod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Located HsModule -&gt; HsModule
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located HsModule
</span><a href="#local-6989586621680995134"><span class="hs-identifier hs-var">rdr_module</span></a></span><span>
</span><span id="line-89"></span><span>                </span><span id="local-6989586621680995123"><span class="annot"><span class="annottext">mb_mod :: Maybe (Located ModuleName)
</span><a href="#local-6989586621680995123"><span class="hs-identifier hs-var hs-var">mb_mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsModule -&gt; Maybe (Located ModuleName)
</span><a href="GHC.Hs.html#hsmodName"><span class="hs-identifier hs-var hs-var">hsmodName</span></a></span><span> </span><span class="annot"><span class="annottext">HsModule
</span><a href="#local-6989586621680995125"><span class="hs-identifier hs-var">hsmod</span></a></span><span>
</span><span id="line-90"></span><span>                </span><span id="local-6989586621680995121"><span class="annot"><span class="annottext">imps :: [LImportDecl GhcPs]
</span><a href="#local-6989586621680995121"><span class="hs-identifier hs-var hs-var">imps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">HsModule -&gt; [LImportDecl GhcPs]
</span><a href="GHC.Hs.html#hsmodImports"><span class="hs-identifier hs-var hs-var">hsmodImports</span></a></span><span> </span><span class="annot"><span class="annottext">HsModule
</span><a href="#local-6989586621680995125"><span class="hs-identifier hs-var">hsmod</span></a></span><span>
</span><span id="line-91"></span><span>                </span><span id="local-6989586621680995119"><span class="annot"><span class="annottext">main_loc :: SrcSpan
</span><a href="#local-6989586621680995119"><span class="hs-identifier hs-var hs-var">main_loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcLoc -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#srcLocSpan"><span class="hs-identifier hs-var">srcLocSpan</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">FastString -&gt; Int -&gt; Int -&gt; SrcLoc
</span><a href="GHC.Types.SrcLoc.html#mkSrcLoc"><span class="hs-identifier hs-var">mkSrcLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#mkFastString"><span class="hs-identifier hs-var">mkFastString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680995145"><span class="hs-identifier hs-var">source_filename</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-92"></span><span>                                       </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span class="hs-special">)</span><span>
</span><span id="line-93"></span><span>                </span><span id="local-6989586621680995116"><span class="annot"><span class="annottext">mod :: Located ModuleName
</span><a href="#local-6989586621680995116"><span class="hs-identifier hs-var hs-var">mod</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Located ModuleName)
</span><a href="#local-6989586621680995123"><span class="hs-identifier hs-var">mb_mod</span></a></span><span> </span><span class="annot"><span class="annottext">Maybe (Located ModuleName)
-&gt; Located ModuleName -&gt; Located ModuleName
forall a. Maybe a -&gt; a -&gt; a
</span><a href="GHC.Data.Maybe.html#orElse"><span class="hs-operator hs-var">`orElse`</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ModuleName -&gt; Located ModuleName
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680995119"><span class="hs-identifier hs-var">main_loc</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="GHC.Builtin.Names.html#mAIN_NAME"><span class="hs-identifier hs-var">mAIN_NAME</span></a></span><span>
</span><span id="line-94"></span><span>                </span><span class="hs-special">(</span><span id="local-6989586621680995112"><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621680995112"><span class="hs-identifier hs-var">src_idecls</span></a></span></span><span class="hs-special">,</span><span> </span><span id="local-6989586621680995111"><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621680995111"><span class="hs-identifier hs-var">ord_idecls</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LImportDecl GhcPs -&gt; Bool)
-&gt; [LImportDecl GhcPs]
-&gt; ([LImportDecl GhcPs], [LImportDecl GhcPs])
forall a. (a -&gt; Bool) -&gt; [a] -&gt; ([a], [a])
</span><a href="../../base/src/Data.OldList.html#partition"><span class="hs-identifier hs-var">partition</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">IsBootInterface -&gt; IsBootInterface -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#IsBoot"><span class="hs-identifier hs-var">IsBoot</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(IsBootInterface -&gt; Bool)
-&gt; (LImportDecl GhcPs -&gt; IsBootInterface)
-&gt; LImportDecl GhcPs
-&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcPs -&gt; IsBootInterface
forall pass. ImportDecl pass -&gt; IsBootInterface
</span><a href="GHC.Hs.ImpExp.html#ideclSource"><span class="hs-identifier hs-var hs-var">ideclSource</span></a></span><span> </span><span class="annot"><span class="annottext">(ImportDecl GhcPs -&gt; IsBootInterface)
-&gt; (LImportDecl GhcPs -&gt; ImportDecl GhcPs)
-&gt; LImportDecl GhcPs
-&gt; IsBootInterface
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LImportDecl GhcPs -&gt; ImportDecl GhcPs
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621680995121"><span class="hs-identifier hs-var">imps</span></a></span><span>
</span><span id="line-95"></span><span>
</span><span id="line-96"></span><span>               </span><span class="hs-comment">-- GHC.Prim doesn't exist physically, so don't go looking for it.</span><span>
</span><span id="line-97"></span><span>                </span><span id="local-6989586621680995106"><span class="annot"><span class="annottext">ordinary_imps :: [LImportDecl GhcPs]
</span><a href="#local-6989586621680995106"><span class="hs-identifier hs-var hs-var">ordinary_imps</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(LImportDecl GhcPs -&gt; Bool)
-&gt; [LImportDecl GhcPs] -&gt; [LImportDecl GhcPs]
forall a. (a -&gt; Bool) -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.List.html#filter"><span class="hs-identifier hs-var">filter</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><span class="annottext">ModuleName -&gt; ModuleName -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">/=</span></span><span> </span><span class="annot"><span class="annottext">GenModule Unit -&gt; ModuleName
forall unit. GenModule unit -&gt; ModuleName
</span><a href="GHC.Unit.Types.html#moduleName"><span class="hs-identifier hs-var hs-var">moduleName</span></a></span><span> </span><span class="annot"><span class="annottext">GenModule Unit
</span><a href="GHC.Builtin.Names.html#gHC_PRIM"><span class="hs-identifier hs-var">gHC_PRIM</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(ModuleName -&gt; Bool)
-&gt; (LImportDecl GhcPs -&gt; ModuleName) -&gt; LImportDecl GhcPs -&gt; Bool
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">Located ModuleName -&gt; ModuleName
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span>
</span><span id="line-98"></span><span>                                        </span><span class="annot"><span class="annottext">(Located ModuleName -&gt; ModuleName)
-&gt; (LImportDecl GhcPs -&gt; Located ModuleName)
-&gt; LImportDecl GhcPs
-&gt; ModuleName
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl GhcPs -&gt; Located ModuleName
forall pass. ImportDecl pass -&gt; Located ModuleName
</span><a href="GHC.Hs.ImpExp.html#ideclName"><span class="hs-identifier hs-var hs-var">ideclName</span></a></span><span> </span><span class="annot"><span class="annottext">(ImportDecl GhcPs -&gt; Located ModuleName)
-&gt; (LImportDecl GhcPs -&gt; ImportDecl GhcPs)
-&gt; LImportDecl GhcPs
-&gt; Located ModuleName
forall b c a. (b -&gt; c) -&gt; (a -&gt; b) -&gt; a -&gt; c
</span><a href="../../base/src/GHC.Base.html#."><span class="hs-operator hs-var">.</span></a></span><span> </span><span class="annot"><span class="annottext">LImportDecl GhcPs -&gt; ImportDecl GhcPs
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-99"></span><span>                                       </span><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621680995111"><span class="hs-identifier hs-var">ord_idecls</span></a></span><span>
</span><span id="line-100"></span><span>
</span><span id="line-101"></span><span>                </span><span id="local-6989586621680995101"><span class="annot"><span class="annottext">implicit_prelude :: Bool
</span><a href="#local-6989586621680995101"><span class="hs-identifier hs-var hs-var">implicit_prelude</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Extension -&gt; DynFlags -&gt; Bool
</span><a href="GHC.Driver.Session.html#xopt"><span class="hs-identifier hs-var">xopt</span></a></span><span> </span><span class="annot"><span class="annottext">Extension
</span><a href="../../ghc-boot-th/src/GHC.LanguageExtensions.Type.html#ImplicitPrelude"><span class="hs-identifier hs-var">LangExt.ImplicitPrelude</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995148"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-102"></span><span>                </span><span id="local-6989586621680995098"><span class="annot"><span class="annottext">implicit_imports :: [LImportDecl GhcPs]
</span><a href="#local-6989586621680995098"><span class="hs-identifier hs-var hs-var">implicit_imports</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ModuleName
-&gt; SrcSpan -&gt; Bool -&gt; [LImportDecl GhcPs] -&gt; [LImportDecl GhcPs]
</span><a href="GHC.Parser.Header.html#mkPrelImports"><span class="hs-identifier hs-var">mkPrelImports</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located ModuleName -&gt; ModuleName
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located ModuleName
</span><a href="#local-6989586621680995116"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680995119"><span class="hs-identifier hs-var">main_loc</span></a></span><span>
</span><span id="line-103"></span><span>                                                 </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680995101"><span class="hs-identifier hs-var">implicit_prelude</span></a></span><span> </span><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621680995121"><span class="hs-identifier hs-var">imps</span></a></span><span>
</span><span id="line-104"></span><span>                </span><span id="local-6989586621680995095"><span class="annot"><span class="annottext">convImport :: GenLocated l (ImportDecl pass)
-&gt; (Maybe FastString, Located ModuleName)
</span><a href="#local-6989586621680995095"><span class="hs-identifier hs-var hs-var">convImport</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">l
</span><span class="hs-identifier">_</span></span><span> </span><span id="local-6989586621680995094"><span class="annot"><span class="annottext">ImportDecl pass
</span><a href="#local-6989586621680995094"><span class="hs-identifier hs-var">i</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(StringLiteral -&gt; FastString)
-&gt; Maybe StringLiteral -&gt; Maybe FastString
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="annot"><span class="annottext">StringLiteral -&gt; FastString
</span><a href="GHC.Types.Basic.html#sl_fs"><span class="hs-identifier hs-var hs-var">sl_fs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ImportDecl pass -&gt; Maybe StringLiteral
forall pass. ImportDecl pass -&gt; Maybe StringLiteral
</span><a href="GHC.Hs.ImpExp.html#ideclPkgQual"><span class="hs-identifier hs-var hs-var">ideclPkgQual</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl pass
</span><a href="#local-6989586621680995094"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ImportDecl pass -&gt; Located ModuleName
forall pass. ImportDecl pass -&gt; Located ModuleName
</span><a href="GHC.Hs.ImpExp.html#ideclName"><span class="hs-identifier hs-var hs-var">ideclName</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl pass
</span><a href="#local-6989586621680995094"><span class="hs-identifier hs-var">i</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-105"></span><span>              </span><span class="hs-keyword">in</span><span>
</span><span id="line-106"></span><span>              </span><span class="annot"><span class="annottext">([(Maybe FastString, Located ModuleName)],
 [(Maybe FastString, Located ModuleName)], Located ModuleName)
-&gt; IO
     ([(Maybe FastString, Located ModuleName)],
      [(Maybe FastString, Located ModuleName)], Located ModuleName)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(LImportDecl GhcPs -&gt; (Maybe FastString, Located ModuleName))
-&gt; [LImportDecl GhcPs] -&gt; [(Maybe FastString, Located ModuleName)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LImportDecl GhcPs -&gt; (Maybe FastString, Located ModuleName)
forall {l} {pass}.
GenLocated l (ImportDecl pass)
-&gt; (Maybe FastString, Located ModuleName)
</span><a href="#local-6989586621680995095"><span class="hs-identifier hs-var">convImport</span></a></span><span> </span><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621680995112"><span class="hs-identifier hs-var">src_idecls</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-107"></span><span>                      </span><span class="annot"><span class="annottext">(LImportDecl GhcPs -&gt; (Maybe FastString, Located ModuleName))
-&gt; [LImportDecl GhcPs] -&gt; [(Maybe FastString, Located ModuleName)]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">LImportDecl GhcPs -&gt; (Maybe FastString, Located ModuleName)
forall {l} {pass}.
GenLocated l (ImportDecl pass)
-&gt; (Maybe FastString, Located ModuleName)
</span><a href="#local-6989586621680995095"><span class="hs-identifier hs-var">convImport</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621680995098"><span class="hs-identifier hs-var">implicit_imports</span></a></span><span> </span><span class="annot"><span class="annottext">[LImportDecl GhcPs] -&gt; [LImportDecl GhcPs] -&gt; [LImportDecl GhcPs]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621680995106"><span class="hs-identifier hs-var">ordinary_imps</span></a></span><span class="hs-special">)</span><span class="hs-special">,</span><span>
</span><span id="line-108"></span><span>                      </span><span class="annot"><span class="annottext">Located ModuleName
</span><a href="#local-6989586621680995116"><span class="hs-identifier hs-var">mod</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-109"></span><span>
</span><span id="line-110"></span><span class="annot"><a href="GHC.Parser.Header.html#mkPrelImports"><span class="hs-identifier hs-type">mkPrelImports</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Unit.Module.Name.html#ModuleName"><span class="hs-identifier hs-type">ModuleName</span></a></span><span>
</span><span id="line-111"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span>    </span><span class="hs-comment">-- Attribute the &quot;import Prelude&quot; to this location</span><span>
</span><span id="line-112"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LImportDecl"><span class="hs-identifier hs-type">LImportDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-113"></span><span>              </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Hs.ImpExp.html#LImportDecl"><span class="hs-identifier hs-type">LImportDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-114"></span><span class="hs-comment">-- Construct the implicit declaration &quot;import Prelude&quot; (or not)</span><span>
</span><span id="line-115"></span><span class="hs-comment">--</span><span>
</span><span id="line-116"></span><span class="hs-comment">-- NB: opt_NoImplicitPrelude is slightly different to import Prelude ();</span><span>
</span><span id="line-117"></span><span class="hs-comment">-- because the former doesn't even look at Prelude.hi for instance</span><span>
</span><span id="line-118"></span><span class="hs-comment">-- declarations, whereas the latter does.</span><span>
</span><span id="line-119"></span><span id="mkPrelImports"><span class="annot"><span class="annottext">mkPrelImports :: ModuleName
-&gt; SrcSpan -&gt; Bool -&gt; [LImportDecl GhcPs] -&gt; [LImportDecl GhcPs]
</span><a href="GHC.Parser.Header.html#mkPrelImports"><span class="hs-identifier hs-var hs-var">mkPrelImports</span></a></span></span><span> </span><span id="local-6989586621680995091"><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621680995091"><span class="hs-identifier hs-var">this_mod</span></a></span></span><span> </span><span id="local-6989586621680995090"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680995090"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621680995089"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680995089"><span class="hs-identifier hs-var">implicit_prelude</span></a></span></span><span> </span><span id="local-6989586621680995088"><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621680995088"><span class="hs-identifier hs-var">import_decls</span></a></span></span><span>
</span><span id="line-120"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="#local-6989586621680995091"><span class="hs-identifier hs-var">this_mod</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; ModuleName -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="GHC.Builtin.Names.html#pRELUDE_NAME"><span class="hs-identifier hs-var">pRELUDE_NAME</span></a></span><span>
</span><span id="line-121"></span><span>   </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680995085"><span class="hs-identifier hs-var">explicit_prelude_import</span></a></span><span>
</span><span id="line-122"></span><span>   </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">||</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680995089"><span class="hs-identifier hs-var">implicit_prelude</span></a></span><span>
</span><span id="line-123"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-124"></span><span>  </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">LImportDecl GhcPs
</span><a href="#local-6989586621680995083"><span class="hs-identifier hs-var">preludeImportDecl</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-125"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-126"></span><span>      </span><span id="local-6989586621680995085"><span class="annot"><span class="annottext">explicit_prelude_import :: Bool
</span><a href="#local-6989586621680995085"><span class="hs-identifier hs-var hs-var">explicit_prelude_import</span></a></span></span><span>
</span><span id="line-127"></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[()] -&gt; Bool
forall a. [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#notNull"><span class="hs-identifier hs-var">notNull</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Hs.ImpExp.html#ImportDecl"><span class="hs-identifier hs-type">ImportDecl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ideclName :: forall pass. ImportDecl pass -&gt; Located ModuleName
</span><a href="GHC.Hs.ImpExp.html#ideclName"><span class="hs-identifier hs-var">ideclName</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span id="local-6989586621680995080"><span class="annot"><span class="annottext">Located ModuleName
</span><a href="#local-6989586621680995080"><span class="hs-identifier hs-var">mod</span></a></span></span><span>
</span><span id="line-128"></span><span>                                        </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">ideclPkgQual :: forall pass. ImportDecl pass -&gt; Maybe StringLiteral
</span><a href="GHC.Hs.ImpExp.html#ideclPkgQual"><span class="hs-identifier hs-var">ideclPkgQual</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe StringLiteral
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span> </span><span class="hs-special">}</span><span class="hs-special">)</span><span>
</span><span id="line-129"></span><span>                          </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[LImportDecl GhcPs]
</span><a href="#local-6989586621680995088"><span class="hs-identifier hs-var">import_decls</span></a></span><span>
</span><span id="line-130"></span><span>                      </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Located ModuleName -&gt; ModuleName
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located ModuleName
</span><a href="#local-6989586621680995080"><span class="hs-identifier hs-var">mod</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName -&gt; ModuleName -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="GHC.Builtin.Names.html#pRELUDE_NAME"><span class="hs-identifier hs-var">pRELUDE_NAME</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-131"></span><span>
</span><span id="line-132"></span><span>      </span><span class="annot"><a href="#local-6989586621680995083"><span class="hs-identifier hs-type">preludeImportDecl</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Hs.ImpExp.html#LImportDecl"><span class="hs-identifier hs-type">LImportDecl</span></a></span><span> </span><span class="annot"><a href="GHC.Hs.Extension.html#GhcPs"><span class="hs-identifier hs-type">GhcPs</span></a></span><span>
</span><span id="line-133"></span><span>      </span><span id="local-6989586621680995083"><span class="annot"><span class="annottext">preludeImportDecl :: LImportDecl GhcPs
</span><a href="#local-6989586621680995083"><span class="hs-identifier hs-var hs-var">preludeImportDecl</span></a></span></span><span>
</span><span id="line-134"></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ImportDecl GhcPs -&gt; LImportDecl GhcPs
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680995090"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(ImportDecl GhcPs -&gt; LImportDecl GhcPs)
-&gt; ImportDecl GhcPs -&gt; LImportDecl GhcPs
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ImportDecl :: forall pass.
XCImportDecl pass
-&gt; SourceText
-&gt; Located ModuleName
-&gt; Maybe StringLiteral
-&gt; IsBootInterface
-&gt; Bool
-&gt; ImportDeclQualifiedStyle
-&gt; Bool
-&gt; Maybe (Located ModuleName)
-&gt; Maybe (Bool, Located [LIE pass])
-&gt; ImportDecl pass
</span><a href="GHC.Hs.ImpExp.html#ImportDecl"><span class="hs-identifier hs-type">ImportDecl</span></a></span><span> </span><span class="hs-special">{</span><span> </span><span class="annot"><span class="annottext">ideclExt :: XCImportDecl GhcPs
</span><a href="GHC.Hs.ImpExp.html#ideclExt"><span class="hs-identifier hs-var">ideclExt</span></a></span><span>       </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">NoExtField
XCImportDecl GhcPs
</span><a href="GHC.Hs.Extension.html#noExtField"><span class="hs-identifier hs-var">noExtField</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-135"></span><span>                               </span><span class="annot"><span class="annottext">ideclSourceSrc :: SourceText
</span><a href="GHC.Hs.ImpExp.html#ideclSourceSrc"><span class="hs-identifier hs-var">ideclSourceSrc</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SourceText
</span><a href="GHC.Types.Basic.html#NoSourceText"><span class="hs-identifier hs-var">NoSourceText</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-136"></span><span>                               </span><span class="annot"><span class="annottext">ideclName :: Located ModuleName
</span><a href="GHC.Hs.ImpExp.html#ideclName"><span class="hs-identifier hs-var">ideclName</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; ModuleName -&gt; Located ModuleName
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680995090"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">ModuleName
</span><a href="GHC.Builtin.Names.html#pRELUDE_NAME"><span class="hs-identifier hs-var">pRELUDE_NAME</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-137"></span><span>                               </span><span class="annot"><span class="annottext">ideclPkgQual :: Maybe StringLiteral
</span><a href="GHC.Hs.ImpExp.html#ideclPkgQual"><span class="hs-identifier hs-var">ideclPkgQual</span></a></span><span>   </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe StringLiteral
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-138"></span><span>                               </span><span class="annot"><span class="annottext">ideclSource :: IsBootInterface
</span><a href="GHC.Hs.ImpExp.html#ideclSource"><span class="hs-identifier hs-var">ideclSource</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IsBootInterface
</span><a href="GHC.Unit.Types.html#NotBoot"><span class="hs-identifier hs-var">NotBoot</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-139"></span><span>                               </span><span class="annot"><span class="annottext">ideclSafe :: Bool
</span><a href="GHC.Hs.ImpExp.html#ideclSafe"><span class="hs-identifier hs-var">ideclSafe</span></a></span><span>      </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span class="hs-special">,</span><span>  </span><span class="hs-comment">-- Not a safe import</span><span>
</span><span id="line-140"></span><span>                               </span><span class="annot"><span class="annottext">ideclQualified :: ImportDeclQualifiedStyle
</span><a href="GHC.Hs.ImpExp.html#ideclQualified"><span class="hs-identifier hs-var">ideclQualified</span></a></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">ImportDeclQualifiedStyle
</span><a href="GHC.Hs.ImpExp.html#NotQualified"><span class="hs-identifier hs-var">NotQualified</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-141"></span><span>                               </span><span class="annot"><span class="annottext">ideclImplicit :: Bool
</span><a href="GHC.Hs.ImpExp.html#ideclImplicit"><span class="hs-identifier hs-var">ideclImplicit</span></a></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span class="hs-special">,</span><span>   </span><span class="hs-comment">-- Implicit!</span><span>
</span><span id="line-142"></span><span>                               </span><span class="annot"><span class="annottext">ideclAs :: Maybe (Located ModuleName)
</span><a href="GHC.Hs.ImpExp.html#ideclAs"><span class="hs-identifier hs-var">ideclAs</span></a></span><span>        </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Located ModuleName)
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span class="hs-special">,</span><span>
</span><span id="line-143"></span><span>                               </span><span class="annot"><span class="annottext">ideclHiding :: Maybe (Bool, Located [LIE GhcPs])
</span><a href="GHC.Hs.ImpExp.html#ideclHiding"><span class="hs-identifier hs-var">ideclHiding</span></a></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Maybe (Bool, Located [LIE GhcPs])
forall a. Maybe a
</span><a href="../../base/src/GHC.Maybe.html#Nothing"><span class="hs-identifier hs-var">Nothing</span></a></span><span>  </span><span class="hs-special">}</span><span>
</span><span id="line-144"></span><span>
</span><span id="line-145"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-146"></span><span class="hs-comment">-- Get options</span><span>
</span><span id="line-147"></span><span class="hs-comment">--------------------------------------------------------------</span><span>
</span><span id="line-148"></span><span>
</span><span id="line-149"></span><span class="hs-comment">-- | Parse OPTIONS and LANGUAGE pragmas of the source file.</span><span>
</span><span id="line-150"></span><span class="hs-comment">--</span><span>
</span><span id="line-151"></span><span class="hs-comment">-- Throws a 'SourceError' if flag parsing fails (including unsupported flags.)</span><span>
</span><span id="line-152"></span><span class="annot"><a href="GHC.Parser.Header.html#getOptionsFromFile"><span class="hs-identifier hs-type">getOptionsFromFile</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-153"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>            </span><span class="hs-comment">-- ^ Input file</span><span>
</span><span id="line-154"></span><span>                   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- ^ Parsed options, if any.</span><span>
</span><span id="line-155"></span><span id="getOptionsFromFile"><span class="annot"><span class="annottext">getOptionsFromFile :: DynFlags -&gt; String -&gt; IO [Located String]
</span><a href="GHC.Parser.Header.html#getOptionsFromFile"><span class="hs-identifier hs-var hs-var">getOptionsFromFile</span></a></span></span><span> </span><span id="local-6989586621680995068"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995068"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680995067"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680995067"><span class="hs-identifier hs-var">filename</span></a></span></span><span>
</span><span id="line-156"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">IO Handle
-&gt; (Handle -&gt; IO ())
-&gt; (Handle -&gt; IO [Located String])
-&gt; IO [Located String]
forall a b c. IO a -&gt; (a -&gt; IO b) -&gt; (a -&gt; IO c) -&gt; IO c
</span><a href="../../base/src/Control.Exception.Base.html#bracket"><span class="hs-identifier hs-var">Exception.bracket</span></a></span><span>
</span><span id="line-157"></span><span>              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; IOMode -&gt; IO Handle
</span><a href="../../base/src/GHC.IO.StdHandles.html#openBinaryFile"><span class="hs-identifier hs-var">openBinaryFile</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680995067"><span class="hs-identifier hs-var">filename</span></a></span><span> </span><span class="annot"><span class="annottext">IOMode
</span><a href="../../base/src/GHC.IO.IOMode.html#ReadMode"><span class="hs-identifier hs-var">ReadMode</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-158"></span><span>              </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Handle -&gt; IO ()
</span><a href="../../base/src/GHC.IO.Handle.html#hClose"><span class="hs-identifier hs-var">hClose</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-159"></span><span>              </span><span class="hs-special">(</span><span class="hs-glyph">\</span><span id="local-6989586621680995062"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680995062"><span class="hs-identifier hs-var">handle</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-160"></span><span>                  </span><span id="local-6989586621680995061"><span class="annot"><span class="annottext">[Located String]
</span><a href="#local-6989586621680995061"><span class="hs-identifier hs-var">opts</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">([Located Token] -&gt; [Located String])
-&gt; IO [Located Token] -&gt; IO [Located String]
forall (f :: * -&gt; *) a b. Functor f =&gt; (a -&gt; b) -&gt; f a -&gt; f b
</span><a href="../../base/src/GHC.Base.html#fmap"><span class="hs-identifier hs-var">fmap</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; [Located Token] -&gt; [Located String]
</span><a href="GHC.Parser.Header.html#getOptions%27"><span class="hs-identifier hs-var">getOptions'</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995068"><span class="hs-identifier hs-var">dflags</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-161"></span><span>                               </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; Handle -&gt; IO [Located Token]
</span><a href="GHC.Parser.Header.html#lazyGetToks"><span class="hs-identifier hs-var">lazyGetToks</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995058"><span class="hs-identifier hs-var">dflags'</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680995067"><span class="hs-identifier hs-var">filename</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680995062"><span class="hs-identifier hs-var">handle</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-162"></span><span>                  </span><span class="annot"><span class="annottext">[Located String] -&gt; IO [Located String] -&gt; IO [Located String]
forall a b. [a] -&gt; b -&gt; b
</span><a href="GHC.Utils.Misc.html#seqList"><span class="hs-identifier hs-var">seqList</span></a></span><span> </span><span class="annot"><span class="annottext">[Located String]
</span><a href="#local-6989586621680995061"><span class="hs-identifier hs-var">opts</span></a></span><span> </span><span class="annot"><span class="annottext">(IO [Located String] -&gt; IO [Located String])
-&gt; IO [Located String] -&gt; IO [Located String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[Located String] -&gt; IO [Located String]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="annot"><span class="annottext">[Located String]
</span><a href="#local-6989586621680995061"><span class="hs-identifier hs-var">opts</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-163"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span class="hs-comment">-- We don't need to get haddock doc tokens when we're just</span><span>
</span><span id="line-164"></span><span>          </span><span class="hs-comment">-- getting the options from pragmas, and lazily lexing them</span><span>
</span><span id="line-165"></span><span>          </span><span class="hs-comment">-- correctly is a little tricky: If there is &quot;\n&quot; or &quot;\n-&quot;</span><span>
</span><span id="line-166"></span><span>          </span><span class="hs-comment">-- left at the end of a buffer then the haddock doc may</span><span>
</span><span id="line-167"></span><span>          </span><span class="hs-comment">-- continue past the end of the buffer, despite the fact that</span><span>
</span><span id="line-168"></span><span>          </span><span class="hs-comment">-- we already have an apparently-complete token.</span><span>
</span><span id="line-169"></span><span>          </span><span class="hs-comment">-- We therefore just turn Opt_Haddock off when doing the lazy</span><span>
</span><span id="line-170"></span><span>          </span><span class="hs-comment">-- lex.</span><span>
</span><span id="line-171"></span><span>          </span><span id="local-6989586621680995058"><span class="annot"><span class="annottext">dflags' :: DynFlags
</span><a href="#local-6989586621680995058"><span class="hs-identifier hs-var hs-var">dflags'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; GeneralFlag -&gt; DynFlags
</span><a href="GHC.Driver.Session.html#gopt_unset"><span class="hs-identifier hs-var">gopt_unset</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995068"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">GeneralFlag
</span><a href="GHC.Driver.Flags.html#Opt_Haddock"><span class="hs-identifier hs-var">Opt_Haddock</span></a></span><span>
</span><span id="line-172"></span><span>
</span><span id="line-173"></span><span class="annot"><a href="GHC.Parser.Header.html#blockSize"><span class="hs-identifier hs-type">blockSize</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span>
</span><span id="line-174"></span><span class="hs-comment">-- blockSize = 17 -- for testing :-)</span><span>
</span><span id="line-175"></span><span id="blockSize"><span class="annot"><span class="annottext">blockSize :: Int
</span><a href="GHC.Parser.Header.html#blockSize"><span class="hs-identifier hs-var hs-var">blockSize</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1024</span></span><span>
</span><span id="line-176"></span><span>
</span><span id="line-177"></span><span class="annot"><a href="GHC.Parser.Header.html#lazyGetToks"><span class="hs-identifier hs-type">lazyGetToks</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#Token"><span class="hs-identifier hs-type">Token</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-178"></span><span id="lazyGetToks"><span class="annot"><span class="annottext">lazyGetToks :: DynFlags -&gt; String -&gt; Handle -&gt; IO [Located Token]
</span><a href="GHC.Parser.Header.html#lazyGetToks"><span class="hs-identifier hs-var hs-var">lazyGetToks</span></a></span></span><span> </span><span id="local-6989586621680995053"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995053"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680995052"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680995052"><span class="hs-identifier hs-var">filename</span></a></span></span><span> </span><span id="local-6989586621680995051"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680995051"><span class="hs-identifier hs-var">handle</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-179"></span><span>  </span><span id="local-6989586621680995050"><span class="annot"><span class="annottext">StringBuffer
</span><a href="#local-6989586621680995050"><span class="hs-identifier hs-var">buf</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; Int -&gt; IO StringBuffer
</span><a href="GHC.Data.StringBuffer.html#hGetStringBufferBlock"><span class="hs-identifier hs-var">hGetStringBufferBlock</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680995051"><span class="hs-identifier hs-var">handle</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="GHC.Parser.Header.html#blockSize"><span class="hs-identifier hs-var">blockSize</span></a></span><span>
</span><span id="line-180"></span><span>  </span><span class="annot"><span class="annottext">IO [Located Token] -&gt; IO [Located Token]
forall a. IO a -&gt; IO a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafeInterleaveIO"><span class="hs-identifier hs-var">unsafeInterleaveIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO [Located Token] -&gt; IO [Located Token])
-&gt; IO [Located Token] -&gt; IO [Located Token]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Handle -&gt; PState -&gt; Bool -&gt; Int -&gt; IO [Located Token]
</span><a href="#local-6989586621680995047"><span class="hs-identifier hs-var">lazyLexBuf</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680995051"><span class="hs-identifier hs-var">handle</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; StringBuffer -&gt; RealSrcLoc -&gt; PState
</span><a href="GHC.Parser.Lexer.html#pragState"><span class="hs-identifier hs-var">pragState</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995053"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">StringBuffer
</span><a href="#local-6989586621680995050"><span class="hs-identifier hs-var">buf</span></a></span><span> </span><span class="annot"><span class="annottext">RealSrcLoc
</span><a href="#local-6989586621680995045"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="GHC.Parser.Header.html#blockSize"><span class="hs-identifier hs-var">blockSize</span></a></span><span>
</span><span id="line-181"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-182"></span><span>  </span><span id="local-6989586621680995045"><span class="annot"><span class="annottext">loc :: RealSrcLoc
</span><a href="#local-6989586621680995045"><span class="hs-identifier hs-var hs-var">loc</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Int -&gt; Int -&gt; RealSrcLoc
</span><a href="GHC.Types.SrcLoc.html#mkRealSrcLoc"><span class="hs-identifier hs-var">mkRealSrcLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#mkFastString"><span class="hs-identifier hs-var">mkFastString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680995052"><span class="hs-identifier hs-var">filename</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-183"></span><span>
</span><span id="line-184"></span><span>  </span><span class="annot"><a href="#local-6989586621680995047"><span class="hs-identifier hs-type">lazyLexBuf</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#PState"><span class="hs-identifier hs-type">PState</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#Token"><span class="hs-identifier hs-type">Token</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-185"></span><span>  </span><span id="local-6989586621680995047"><span class="annot"><span class="annottext">lazyLexBuf :: Handle -&gt; PState -&gt; Bool -&gt; Int -&gt; IO [Located Token]
</span><a href="#local-6989586621680995047"><span class="hs-identifier hs-var hs-var">lazyLexBuf</span></a></span></span><span> </span><span id="local-6989586621680995044"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680995044"><span class="hs-identifier hs-var">handle</span></a></span></span><span> </span><span id="local-6989586621680995043"><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995043"><span class="hs-identifier hs-var">state</span></a></span></span><span> </span><span id="local-6989586621680995042"><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680995042"><span class="hs-identifier hs-var">eof</span></a></span></span><span> </span><span id="local-6989586621680995041"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680995041"><span class="hs-identifier hs-var">size</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-186"></span><span>    </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">P (Located Token) -&gt; PState -&gt; ParseResult (Located Token)
forall a. P a -&gt; PState -&gt; ParseResult a
</span><a href="GHC.Parser.Lexer.html#unP"><span class="hs-identifier hs-var hs-var">unP</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; (Located Token -&gt; P (Located Token)) -&gt; P (Located Token)
forall a. Bool -&gt; (Located Token -&gt; P a) -&gt; P a
</span><a href="GHC.Parser.Lexer.html#lexer"><span class="hs-identifier hs-var">lexer</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Located Token -&gt; P (Located Token)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995043"><span class="hs-identifier hs-var">state</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-187"></span><span>      </span><span class="annot"><a href="GHC.Parser.Lexer.html#POk"><span class="hs-identifier hs-type">POk</span></a></span><span> </span><span id="local-6989586621680995039"><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995039"><span class="hs-identifier hs-var">state'</span></a></span></span><span> </span><span id="local-6989586621680995038"><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680995038"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-188"></span><span>        </span><span class="hs-comment">-- pprTrace &quot;lazyLexBuf&quot; (text (show (buffer state'))) (return ())</span><span>
</span><span id="line-189"></span><span>        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">StringBuffer -&gt; Bool
</span><a href="GHC.Data.StringBuffer.html#atEnd"><span class="hs-identifier hs-var">atEnd</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PState -&gt; StringBuffer
</span><a href="GHC.Parser.Lexer.html#buffer"><span class="hs-identifier hs-var hs-var">buffer</span></a></span><span> </span><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995039"><span class="hs-identifier hs-var">state'</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool -&gt; Bool
</span><span class="hs-operator hs-var">&amp;&amp;</span></span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680995042"><span class="hs-identifier hs-var">eof</span></a></span><span>
</span><span id="line-190"></span><span>           </span><span class="hs-comment">-- if this token reached the end of the buffer, and we haven't</span><span>
</span><span id="line-191"></span><span>           </span><span class="hs-comment">-- necessarily read up to the end of the file, then the token might</span><span>
</span><span id="line-192"></span><span>           </span><span class="hs-comment">-- be truncated, so read some more of the file and lex it again.</span><span>
</span><span id="line-193"></span><span>           </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; PState -&gt; Int -&gt; IO [Located Token]
</span><a href="#local-6989586621680995034"><span class="hs-identifier hs-var">getMore</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680995044"><span class="hs-identifier hs-var">handle</span></a></span><span> </span><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995043"><span class="hs-identifier hs-var">state</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680995041"><span class="hs-identifier hs-var">size</span></a></span><span>
</span><span id="line-194"></span><span>           </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Located Token -&gt; Token
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680995038"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-195"></span><span>                  </span><span class="annot"><span class="annottext">Token
</span><a href="GHC.Parser.Lexer.html#ITeof"><span class="hs-identifier hs-var">ITeof</span></a></span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Located Token] -&gt; IO [Located Token]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680995038"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-196"></span><span>                  </span><span id="local-6989586621680995032"><span class="annot"><span class="annottext">Token
</span><a href="#local-6989586621680995032"><span class="hs-identifier hs-var">_other</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-keyword">do</span><span> </span><span id="local-6989586621680995031"><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680995031"><span class="hs-identifier hs-var">rest</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; PState -&gt; Bool -&gt; Int -&gt; IO [Located Token]
</span><a href="#local-6989586621680995047"><span class="hs-identifier hs-var">lazyLexBuf</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680995044"><span class="hs-identifier hs-var">handle</span></a></span><span> </span><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995039"><span class="hs-identifier hs-var">state'</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680995042"><span class="hs-identifier hs-var">eof</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680995041"><span class="hs-identifier hs-var">size</span></a></span><span>
</span><span id="line-197"></span><span>                               </span><span class="annot"><span class="annottext">[Located Token] -&gt; IO [Located Token]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680995038"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token -&gt; [Located Token] -&gt; [Located Token]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680995031"><span class="hs-identifier hs-var">rest</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-198"></span><span>      </span><span class="annot"><span class="annottext">ParseResult (Located Token)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; Bool
</span><span class="hs-identifier hs-var">not</span></span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="#local-6989586621680995042"><span class="hs-identifier hs-var">eof</span></a></span><span>   </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; PState -&gt; Int -&gt; IO [Located Token]
</span><a href="#local-6989586621680995034"><span class="hs-identifier hs-var">getMore</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680995044"><span class="hs-identifier hs-var">handle</span></a></span><span> </span><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995043"><span class="hs-identifier hs-var">state</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680995041"><span class="hs-identifier hs-var">size</span></a></span><span>
</span><span id="line-199"></span><span>        </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Bool
</span><a href="../../base/src/GHC.Base.html#otherwise"><span class="hs-identifier hs-var">otherwise</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Located Token] -&gt; IO [Located Token]
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">SrcSpan -&gt; Token -&gt; Located Token
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PsSpan -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#mkSrcSpanPs"><span class="hs-identifier hs-var">mkSrcSpanPs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PState -&gt; PsSpan
</span><a href="GHC.Parser.Lexer.html#last_loc"><span class="hs-identifier hs-var hs-var">last_loc</span></a></span><span> </span><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995043"><span class="hs-identifier hs-var">state</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Token
</span><a href="GHC.Parser.Lexer.html#ITeof"><span class="hs-identifier hs-var">ITeof</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-200"></span><span>                         </span><span class="hs-comment">-- parser assumes an ITeof sentinel at the end</span><span>
</span><span id="line-201"></span><span>
</span><span id="line-202"></span><span>  </span><span class="annot"><a href="#local-6989586621680995034"><span class="hs-identifier hs-type">getMore</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.Handle.Types.html#Handle"><span class="hs-identifier hs-type">Handle</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#PState"><span class="hs-identifier hs-type">PState</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Int</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">IO</span></span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#Token"><span class="hs-identifier hs-type">Token</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-203"></span><span>  </span><span id="local-6989586621680995034"><span class="annot"><span class="annottext">getMore :: Handle -&gt; PState -&gt; Int -&gt; IO [Located Token]
</span><a href="#local-6989586621680995034"><span class="hs-identifier hs-var hs-var">getMore</span></a></span></span><span> </span><span id="local-6989586621680995028"><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680995028"><span class="hs-identifier hs-var">handle</span></a></span></span><span> </span><span id="local-6989586621680995027"><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995027"><span class="hs-identifier hs-var">state</span></a></span></span><span> </span><span id="local-6989586621680995026"><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680995026"><span class="hs-identifier hs-var">size</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-204"></span><span>     </span><span class="hs-comment">-- pprTrace &quot;getMore&quot; (text (show (buffer state))) (return ())</span><span>
</span><span id="line-205"></span><span>     </span><span class="hs-keyword">let</span><span> </span><span id="local-6989586621680995025"><span class="annot"><span class="annottext">new_size :: Int
</span><a href="#local-6989586621680995025"><span class="hs-identifier hs-var hs-var">new_size</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680995026"><span class="hs-identifier hs-var">size</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Int
forall a. Num a =&gt; a -&gt; a -&gt; a
</span><a href="../../base/src/GHC.Num.html#%2A"><span class="hs-operator hs-var">*</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span>
</span><span id="line-206"></span><span>       </span><span class="hs-comment">-- double the buffer size each time we read a new block.  This</span><span>
</span><span id="line-207"></span><span>       </span><span class="hs-comment">-- counteracts the quadratic slowdown we otherwise get for very</span><span>
</span><span id="line-208"></span><span>       </span><span class="hs-comment">-- large module names (#5981)</span><span>
</span><span id="line-209"></span><span>     </span><span id="local-6989586621680995023"><span class="annot"><span class="annottext">StringBuffer
</span><a href="#local-6989586621680995023"><span class="hs-identifier hs-var">nextbuf</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; Int -&gt; IO StringBuffer
</span><a href="GHC.Data.StringBuffer.html#hGetStringBufferBlock"><span class="hs-identifier hs-var">hGetStringBufferBlock</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680995028"><span class="hs-identifier hs-var">handle</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680995025"><span class="hs-identifier hs-var">new_size</span></a></span><span>
</span><span id="line-210"></span><span>     </span><span class="hs-keyword">if</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">StringBuffer -&gt; Int
</span><a href="GHC.Data.StringBuffer.html#len"><span class="hs-identifier hs-var hs-var">len</span></a></span><span> </span><span class="annot"><span class="annottext">StringBuffer
</span><a href="#local-6989586621680995023"><span class="hs-identifier hs-var">nextbuf</span></a></span><span> </span><span class="annot"><span class="annottext">Int -&gt; Int -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">0</span></span><span class="hs-special">)</span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">Handle -&gt; PState -&gt; Bool -&gt; Int -&gt; IO [Located Token]
</span><a href="#local-6989586621680995047"><span class="hs-identifier hs-var">lazyLexBuf</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680995028"><span class="hs-identifier hs-var">handle</span></a></span><span> </span><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995027"><span class="hs-identifier hs-var">state</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680995025"><span class="hs-identifier hs-var">new_size</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="hs-keyword">do</span><span>
</span><span id="line-211"></span><span>       </span><span id="local-6989586621680995021"><span class="annot"><span class="annottext">StringBuffer
</span><a href="#local-6989586621680995021"><span class="hs-identifier hs-var">newbuf</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">StringBuffer -&gt; StringBuffer -&gt; IO StringBuffer
</span><a href="GHC.Data.StringBuffer.html#appendStringBuffers"><span class="hs-identifier hs-var">appendStringBuffers</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PState -&gt; StringBuffer
</span><a href="GHC.Parser.Lexer.html#buffer"><span class="hs-identifier hs-var hs-var">buffer</span></a></span><span> </span><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995027"><span class="hs-identifier hs-var">state</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">StringBuffer
</span><a href="#local-6989586621680995023"><span class="hs-identifier hs-var">nextbuf</span></a></span><span>
</span><span id="line-212"></span><span>       </span><span class="annot"><span class="annottext">IO [Located Token] -&gt; IO [Located Token]
forall a. IO a -&gt; IO a
</span><a href="../../base/src/GHC.IO.Unsafe.html#unsafeInterleaveIO"><span class="hs-identifier hs-var">unsafeInterleaveIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO [Located Token] -&gt; IO [Located Token])
-&gt; IO [Located Token] -&gt; IO [Located Token]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Handle -&gt; PState -&gt; Bool -&gt; Int -&gt; IO [Located Token]
</span><a href="#local-6989586621680995047"><span class="hs-identifier hs-var">lazyLexBuf</span></a></span><span> </span><span class="annot"><span class="annottext">Handle
</span><a href="#local-6989586621680995028"><span class="hs-identifier hs-var">handle</span></a></span><span> </span><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995027"><span class="hs-identifier hs-var">state</span></a></span><span class="hs-special">{</span><span class="annot"><span class="annottext">buffer :: StringBuffer
</span><a href="GHC.Parser.Lexer.html#buffer"><span class="hs-identifier hs-var">buffer</span></a></span><span class="hs-glyph">=</span><span class="annot"><span class="annottext">StringBuffer
</span><a href="#local-6989586621680995021"><span class="hs-identifier hs-var">newbuf</span></a></span><span class="hs-special">}</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><a href="#local-6989586621680995025"><span class="hs-identifier hs-var">new_size</span></a></span><span>
</span><span id="line-213"></span><span>
</span><span id="line-214"></span><span>
</span><span id="line-215"></span><span class="annot"><a href="GHC.Parser.Header.html#getToks"><span class="hs-identifier hs-type">getToks</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.StringBuffer.html#StringBuffer"><span class="hs-identifier hs-type">StringBuffer</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#Token"><span class="hs-identifier hs-type">Token</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-216"></span><span id="getToks"><span class="annot"><span class="annottext">getToks :: DynFlags -&gt; String -&gt; StringBuffer -&gt; [Located Token]
</span><a href="GHC.Parser.Header.html#getToks"><span class="hs-identifier hs-var hs-var">getToks</span></a></span></span><span> </span><span id="local-6989586621680995018"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995018"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680995017"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680995017"><span class="hs-identifier hs-var">filename</span></a></span></span><span> </span><span id="local-6989586621680995016"><span class="annot"><span class="annottext">StringBuffer
</span><a href="#local-6989586621680995016"><span class="hs-identifier hs-var">buf</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PState -&gt; [Located Token]
</span><a href="#local-6989586621680995015"><span class="hs-identifier hs-var">lexAll</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; StringBuffer -&gt; RealSrcLoc -&gt; PState
</span><a href="GHC.Parser.Lexer.html#pragState"><span class="hs-identifier hs-var">pragState</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995018"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">StringBuffer
</span><a href="#local-6989586621680995016"><span class="hs-identifier hs-var">buf</span></a></span><span> </span><span class="annot"><span class="annottext">RealSrcLoc
</span><a href="#local-6989586621680995014"><span class="hs-identifier hs-var">loc</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-217"></span><span> </span><span class="hs-keyword">where</span><span>
</span><span id="line-218"></span><span>  </span><span id="local-6989586621680995014"><span class="annot"><span class="annottext">loc :: RealSrcLoc
</span><a href="#local-6989586621680995014"><span class="hs-identifier hs-var hs-var">loc</span></a></span></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; Int -&gt; Int -&gt; RealSrcLoc
</span><a href="GHC.Types.SrcLoc.html#mkRealSrcLoc"><span class="hs-identifier hs-var">mkRealSrcLoc</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; FastString
</span><a href="GHC.Data.FastString.html#mkFastString"><span class="hs-identifier hs-var">mkFastString</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680995017"><span class="hs-identifier hs-var">filename</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">1</span></span><span>
</span><span id="line-219"></span><span>
</span><span id="line-220"></span><span>  </span><span id="local-6989586621680995015"><span class="annot"><span class="annottext">lexAll :: PState -&gt; [Located Token]
</span><a href="#local-6989586621680995015"><span class="hs-identifier hs-var hs-var">lexAll</span></a></span></span><span> </span><span id="local-6989586621680995012"><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995012"><span class="hs-identifier hs-var">state</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">P (Located Token) -&gt; PState -&gt; ParseResult (Located Token)
forall a. P a -&gt; PState -&gt; ParseResult a
</span><a href="GHC.Parser.Lexer.html#unP"><span class="hs-identifier hs-var hs-var">unP</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Bool -&gt; (Located Token -&gt; P (Located Token)) -&gt; P (Located Token)
forall a. Bool -&gt; (Located Token -&gt; P a) -&gt; P a
</span><a href="GHC.Parser.Lexer.html#lexer"><span class="hs-identifier hs-var">lexer</span></a></span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span> </span><span class="annot"><span class="annottext">Located Token -&gt; P (Located Token)
forall (m :: * -&gt; *) a. Monad m =&gt; a -&gt; m a
</span><a href="../../base/src/GHC.Base.html#return"><span class="hs-identifier hs-var">return</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995012"><span class="hs-identifier hs-var">state</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-221"></span><span>                   </span><span class="annot"><a href="GHC.Parser.Lexer.html#POk"><span class="hs-identifier hs-type">POk</span></a></span><span> </span><span class="annot"><span class="annottext">PState
</span><span class="hs-identifier">_</span></span><span>      </span><span id="local-6989586621680995011"><span class="annot"><span class="annottext">t :: Located Token
</span><a href="#local-6989586621680995011"><span class="hs-identifier hs-var">t</span></a></span></span><span class="hs-glyph">@</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><span class="hs-identifier">_</span></span><span> </span><span class="annot"><span class="annottext">Token
</span><a href="GHC.Parser.Lexer.html#ITeof"><span class="hs-identifier hs-var">ITeof</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680995011"><span class="hs-identifier hs-var">t</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-222"></span><span>                   </span><span class="annot"><a href="GHC.Parser.Lexer.html#POk"><span class="hs-identifier hs-type">POk</span></a></span><span> </span><span id="local-6989586621680995010"><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995010"><span class="hs-identifier hs-var">state'</span></a></span></span><span> </span><span id="local-6989586621680995009"><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680995009"><span class="hs-identifier hs-var">t</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680995009"><span class="hs-identifier hs-var">t</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token -&gt; [Located Token] -&gt; [Located Token]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span> </span><span class="annot"><span class="annottext">PState -&gt; [Located Token]
</span><a href="#local-6989586621680995015"><span class="hs-identifier hs-var">lexAll</span></a></span><span> </span><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995010"><span class="hs-identifier hs-var">state'</span></a></span><span>
</span><span id="line-223"></span><span>                   </span><span class="annot"><span class="annottext">ParseResult (Located Token)
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">SrcSpan -&gt; Token -&gt; Located Token
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PsSpan -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#mkSrcSpanPs"><span class="hs-identifier hs-var">mkSrcSpanPs</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">PState -&gt; PsSpan
</span><a href="GHC.Parser.Lexer.html#last_loc"><span class="hs-identifier hs-var hs-var">last_loc</span></a></span><span> </span><span class="annot"><span class="annottext">PState
</span><a href="#local-6989586621680995012"><span class="hs-identifier hs-var">state</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Token
</span><a href="GHC.Parser.Lexer.html#ITeof"><span class="hs-identifier hs-var">ITeof</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-224"></span><span>
</span><span id="line-225"></span><span>
</span><span id="line-226"></span><span class="hs-comment">-- | Parse OPTIONS and LANGUAGE pragmas of the source file.</span><span>
</span><span id="line-227"></span><span class="hs-comment">--</span><span>
</span><span id="line-228"></span><span class="hs-comment">-- Throws a 'SourceError' if flag parsing fails (including unsupported flags.)</span><span>
</span><span id="line-229"></span><span class="annot"><a href="GHC.Parser.Header.html#getOptions"><span class="hs-identifier hs-type">getOptions</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-230"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Data.StringBuffer.html#StringBuffer"><span class="hs-identifier hs-type">StringBuffer</span></a></span><span> </span><span class="hs-comment">-- ^ Input Buffer</span><span>
</span><span id="line-231"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span>     </span><span class="hs-comment">-- ^ Source filename.  Used for location info.</span><span>
</span><span id="line-232"></span><span>           </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-comment">-- ^ Parsed options.</span><span>
</span><span id="line-233"></span><span id="getOptions"><span class="annot"><span class="annottext">getOptions :: DynFlags -&gt; StringBuffer -&gt; String -&gt; [Located String]
</span><a href="GHC.Parser.Header.html#getOptions"><span class="hs-identifier hs-var hs-var">getOptions</span></a></span></span><span> </span><span id="local-6989586621680995008"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995008"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680995007"><span class="annot"><span class="annottext">StringBuffer
</span><a href="#local-6989586621680995007"><span class="hs-identifier hs-var">buf</span></a></span></span><span> </span><span id="local-6989586621680995006"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680995006"><span class="hs-identifier hs-var">filename</span></a></span></span><span>
</span><span id="line-234"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; [Located Token] -&gt; [Located String]
</span><a href="GHC.Parser.Header.html#getOptions%27"><span class="hs-identifier hs-var">getOptions'</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995008"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">DynFlags -&gt; String -&gt; StringBuffer -&gt; [Located Token]
</span><a href="GHC.Parser.Header.html#getToks"><span class="hs-identifier hs-var">getToks</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995008"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680995006"><span class="hs-identifier hs-var">filename</span></a></span><span> </span><span class="annot"><span class="annottext">StringBuffer
</span><a href="#local-6989586621680995007"><span class="hs-identifier hs-var">buf</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-235"></span><span>
</span><span id="line-236"></span><span class="hs-comment">-- The token parser is written manually because Happy can't</span><span>
</span><span id="line-237"></span><span class="hs-comment">-- return a partial result when it encounters a lexer error.</span><span>
</span><span id="line-238"></span><span class="hs-comment">-- We want to extract options before the buffer is passed through</span><span>
</span><span id="line-239"></span><span class="hs-comment">-- CPP, so we can't use the same trick as 'getImports'.</span><span>
</span><span id="line-240"></span><span class="annot"><a href="GHC.Parser.Header.html#getOptions%27"><span class="hs-identifier hs-type">getOptions'</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span>
</span><span id="line-241"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#Token"><span class="hs-identifier hs-type">Token</span></a></span><span class="hs-special">]</span><span>      </span><span class="hs-comment">-- Input buffer</span><span>
</span><span id="line-242"></span><span>            </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span>     </span><span class="hs-comment">-- Options.</span><span>
</span><span id="line-243"></span><span id="getOptions%27"><span class="annot"><span class="annottext">getOptions' :: DynFlags -&gt; [Located Token] -&gt; [Located String]
</span><a href="GHC.Parser.Header.html#getOptions%27"><span class="hs-identifier hs-var hs-var">getOptions'</span></a></span></span><span> </span><span id="local-6989586621680995005"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995005"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680995004"><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680995004"><span class="hs-identifier hs-var">toks</span></a></span></span><span>
</span><span id="line-244"></span><span>    </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Located Token] -&gt; [Located String]
</span><a href="#local-6989586621680995003"><span class="hs-identifier hs-var">parseToks</span></a></span><span> </span><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680995004"><span class="hs-identifier hs-var">toks</span></a></span><span>
</span><span id="line-245"></span><span>    </span><span class="hs-keyword">where</span><span>
</span><span id="line-246"></span><span>          </span><span id="local-6989586621680995003"><span class="annot"><span class="annottext">parseToks :: [Located Token] -&gt; [Located String]
</span><a href="#local-6989586621680995003"><span class="hs-identifier hs-var hs-var">parseToks</span></a></span></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680995002"><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680995002"><span class="hs-identifier hs-var">open</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680995001"><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680995001"><span class="hs-identifier hs-var">close</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680995000"><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680995000"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-247"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#IToptions_prag"><span class="hs-identifier hs-type">IToptions_prag</span></a></span><span> </span><span id="local-6989586621680994998"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994998"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Located Token -&gt; Token
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680995002"><span class="hs-identifier hs-var">open</span></a></span><span>
</span><span id="line-248"></span><span>              </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Token
</span><a href="GHC.Parser.Lexer.html#ITclose_prag"><span class="hs-identifier hs-var">ITclose_prag</span></a></span><span>       </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Located Token -&gt; Token
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680995001"><span class="hs-identifier hs-var">close</span></a></span><span>
</span><span id="line-249"></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">String -&gt; Either String [String]
</span><a href="GHC.Utils.Misc.html#toArgs"><span class="hs-identifier hs-var">toArgs</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994998"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-250"></span><span>                  </span><span class="annot"><a href="../../base/src/Data.Either.html#Left"><span class="hs-identifier hs-type">Left</span></a></span><span> </span><span id="local-6989586621680994995"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994995"><span class="hs-identifier hs-var">_err</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; DynFlags -&gt; SrcSpan -&gt; [Located String]
forall a. String -&gt; DynFlags -&gt; SrcSpan -&gt; a
</span><a href="GHC.Parser.Header.html#optionsParseError"><span class="hs-identifier hs-var">optionsParseError</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994998"><span class="hs-identifier hs-var">str</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995005"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">(SrcSpan -&gt; [Located String]) -&gt; SrcSpan -&gt; [Located String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>   </span><span class="hs-comment">-- #15053</span><span>
</span><span id="line-251"></span><span>                                 </span><span class="annot"><span class="annottext">SrcSpan -&gt; SrcSpan -&gt; SrcSpan
</span><a href="GHC.Types.SrcLoc.html#combineSrcSpans"><span class="hs-identifier hs-var">combineSrcSpans</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Token -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680995002"><span class="hs-identifier hs-var">open</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Token -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680995001"><span class="hs-identifier hs-var">close</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-252"></span><span>                  </span><span class="annot"><a href="../../base/src/Data.Either.html#Right"><span class="hs-identifier hs-type">Right</span></a></span><span> </span><span id="local-6989586621680994991"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680994991"><span class="hs-identifier hs-var">args</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">(String -&gt; Located String) -&gt; [String] -&gt; [Located String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; String -&gt; Located String
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Token -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680995002"><span class="hs-identifier hs-var">open</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680994991"><span class="hs-identifier hs-var">args</span></a></span><span> </span><span class="annot"><span class="annottext">[Located String] -&gt; [Located String] -&gt; [Located String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Located Token] -&gt; [Located String]
</span><a href="#local-6989586621680995003"><span class="hs-identifier hs-var">parseToks</span></a></span><span> </span><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680995000"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-253"></span><span>          </span><span class="annot"><a href="#local-6989586621680995003"><span class="hs-identifier hs-var">parseToks</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680994990"><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994990"><span class="hs-identifier hs-var">open</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680994989"><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994989"><span class="hs-identifier hs-var">close</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680994988"><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680994988"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-254"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#ITinclude_prag"><span class="hs-identifier hs-type">ITinclude_prag</span></a></span><span> </span><span id="local-6989586621680994986"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994986"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Located Token -&gt; Token
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994990"><span class="hs-identifier hs-var">open</span></a></span><span>
</span><span id="line-255"></span><span>              </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Token
</span><a href="GHC.Parser.Lexer.html#ITclose_prag"><span class="hs-identifier hs-var">ITclose_prag</span></a></span><span>       </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Located Token -&gt; Token
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994989"><span class="hs-identifier hs-var">close</span></a></span><span>
</span><span id="line-256"></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; Located String) -&gt; [String] -&gt; [Located String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; String -&gt; Located String
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Token -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994990"><span class="hs-identifier hs-var">open</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-#include&quot;</span></span><span class="hs-special">,</span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="GHC.Utils.Misc.html#removeSpaces"><span class="hs-identifier hs-var">removeSpaces</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994986"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">]</span><span> </span><span class="annot"><span class="annottext">[Located String] -&gt; [Located String] -&gt; [Located String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span>
</span><span id="line-257"></span><span>                </span><span class="annot"><span class="annottext">[Located Token] -&gt; [Located String]
</span><a href="#local-6989586621680995003"><span class="hs-identifier hs-var">parseToks</span></a></span><span> </span><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680994988"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-258"></span><span>          </span><span class="annot"><a href="#local-6989586621680995003"><span class="hs-identifier hs-var">parseToks</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680994984"><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994984"><span class="hs-identifier hs-var">open</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680994983"><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994983"><span class="hs-identifier hs-var">close</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680994982"><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680994982"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-259"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#ITdocOptions"><span class="hs-identifier hs-type">ITdocOptions</span></a></span><span> </span><span id="local-6989586621680994980"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994980"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Located Token -&gt; Token
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994984"><span class="hs-identifier hs-var">open</span></a></span><span>
</span><span id="line-260"></span><span>              </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Token
</span><a href="GHC.Parser.Lexer.html#ITclose_prag"><span class="hs-identifier hs-var">ITclose_prag</span></a></span><span>     </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Located Token -&gt; Token
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994983"><span class="hs-identifier hs-var">close</span></a></span><span>
</span><span id="line-261"></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">(String -&gt; Located String) -&gt; [String] -&gt; [Located String]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; String -&gt; Located String
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Token -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994984"><span class="hs-identifier hs-var">open</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span> </span><span class="hs-special">[</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-haddock-opts&quot;</span></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; String
</span><a href="GHC.Utils.Misc.html#removeSpaces"><span class="hs-identifier hs-var">removeSpaces</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994980"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-262"></span><span>                </span><span class="annot"><span class="annottext">[Located String] -&gt; [Located String] -&gt; [Located String]
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">[Located Token] -&gt; [Located String]
</span><a href="#local-6989586621680995003"><span class="hs-identifier hs-var">parseToks</span></a></span><span> </span><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680994982"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-263"></span><span>          </span><span class="annot"><a href="#local-6989586621680995003"><span class="hs-identifier hs-var">parseToks</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680994979"><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994979"><span class="hs-identifier hs-var">open</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680994978"><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680994978"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-264"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Token
</span><a href="GHC.Parser.Lexer.html#ITlanguage_prag"><span class="hs-identifier hs-var">ITlanguage_prag</span></a></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">Located Token -&gt; Token
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994979"><span class="hs-identifier hs-var">open</span></a></span><span>
</span><span id="line-265"></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Located Token] -&gt; [Located String]
</span><a href="#local-6989586621680994976"><span class="hs-identifier hs-var">parseLanguage</span></a></span><span> </span><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680994978"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-266"></span><span>          </span><span class="annot"><a href="#local-6989586621680995003"><span class="hs-identifier hs-var">parseToks</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680994975"><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994975"><span class="hs-identifier hs-var">comment</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680994974"><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680994974"><span class="hs-identifier hs-var">xs</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-comment">-- Skip over comments</span><span>
</span><span id="line-267"></span><span>              </span><span class="hs-glyph">|</span><span> </span><span class="annot"><span class="annottext">Token -&gt; Bool
</span><a href="#local-6989586621680994973"><span class="hs-identifier hs-var">isComment</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Token -&gt; Token
forall l e. GenLocated l e -&gt; e
</span><a href="GHC.Types.SrcLoc.html#unLoc"><span class="hs-identifier hs-var">unLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994975"><span class="hs-identifier hs-var">comment</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-268"></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">[Located Token] -&gt; [Located String]
</span><a href="#local-6989586621680995003"><span class="hs-identifier hs-var">parseToks</span></a></span><span> </span><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680994974"><span class="hs-identifier hs-var">xs</span></a></span><span>
</span><span id="line-269"></span><span>          </span><span class="annot"><a href="#local-6989586621680995003"><span class="hs-identifier hs-var">parseToks</span></a></span><span> </span><span class="annot"><span class="annottext">[Located Token]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-270"></span><span>          </span><span id="local-6989586621680994976"><span class="annot"><span class="annottext">parseLanguage :: [Located Token] -&gt; [Located String]
</span><a href="#local-6989586621680994976"><span class="hs-identifier hs-var hs-var">parseLanguage</span></a></span></span><span> </span><span class="hs-special">(</span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680994972"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994972"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.Lexer.html#ITconid"><span class="hs-identifier hs-type">ITconid</span></a></span><span> </span><span id="local-6989586621680994970"><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621680994970"><span class="hs-identifier hs-var">fs</span></a></span></span><span class="hs-special">)</span><span class="hs-special">)</span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680994969"><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680994969"><span class="hs-identifier hs-var">rest</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-271"></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Located FastString -&gt; Located String
</span><a href="GHC.Parser.Header.html#checkExtension"><span class="hs-identifier hs-var">checkExtension</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995005"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">SrcSpan -&gt; FastString -&gt; Located FastString
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994972"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621680994970"><span class="hs-identifier hs-var">fs</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">Located String -&gt; [Located String] -&gt; [Located String]
forall a. a -&gt; [a] -&gt; [a]
</span><span class="hs-glyph hs-var">:</span></span><span>
</span><span id="line-272"></span><span>                </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680994969"><span class="hs-identifier hs-var">rest</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-273"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680994967"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994967"><span class="hs-identifier hs-var">_loc</span></a></span></span><span> </span><span class="annot"><span class="annottext">Token
</span><a href="GHC.Parser.Lexer.html#ITcomma"><span class="hs-identifier hs-var">ITcomma</span></a></span><span class="hs-special">)</span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680994965"><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680994965"><span class="hs-identifier hs-var">more</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Located Token] -&gt; [Located String]
</span><a href="#local-6989586621680994976"><span class="hs-identifier hs-var">parseLanguage</span></a></span><span> </span><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680994965"><span class="hs-identifier hs-var">more</span></a></span><span>
</span><span id="line-274"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680994964"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994964"><span class="hs-identifier hs-var">_loc</span></a></span></span><span> </span><span class="annot"><span class="annottext">Token
</span><a href="GHC.Parser.Lexer.html#ITclose_prag"><span class="hs-identifier hs-var">ITclose_prag</span></a></span><span class="hs-special">)</span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span id="local-6989586621680994963"><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680994963"><span class="hs-identifier hs-var">more</span></a></span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">[Located Token] -&gt; [Located String]
</span><a href="#local-6989586621680995003"><span class="hs-identifier hs-var">parseToks</span></a></span><span> </span><span class="annot"><span class="annottext">[Located Token]
</span><a href="#local-6989586621680994963"><span class="hs-identifier hs-var">more</span></a></span><span>
</span><span id="line-275"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680994962"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994962"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="annot"><span class="annottext">Token
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">[Located Token]
</span><span class="hs-identifier">_</span></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SrcSpan -&gt; [Located String]
forall a. DynFlags -&gt; SrcSpan -&gt; a
</span><a href="GHC.Parser.Header.html#languagePragParseError"><span class="hs-identifier hs-var">languagePragParseError</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995005"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994962"><span class="hs-identifier hs-var">loc</span></a></span><span>
</span><span id="line-276"></span><span>                  </span><span class="hs-special">[</span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">String -&gt; [Located String]
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;getOptions'.parseLanguage(1) went past eof token&quot;</span></span><span>
</span><span id="line-277"></span><span>          </span><span class="annot"><a href="#local-6989586621680994976"><span class="hs-identifier hs-var">parseLanguage</span></a></span><span> </span><span class="hs-special">(</span><span id="local-6989586621680994959"><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994959"><span class="hs-identifier hs-var">tok</span></a></span></span><span class="annot"><span class="hs-glyph hs-type">:</span></span><span class="annot"><span class="annottext">[Located Token]
</span><span class="hs-identifier">_</span></span><span class="hs-special">)</span><span>
</span><span id="line-278"></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SrcSpan -&gt; [Located String]
forall a. DynFlags -&gt; SrcSpan -&gt; a
</span><a href="GHC.Parser.Header.html#languagePragParseError"><span class="hs-identifier hs-var">languagePragParseError</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680995005"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">Located Token -&gt; SrcSpan
forall l e. GenLocated l e -&gt; l
</span><a href="GHC.Types.SrcLoc.html#getLoc"><span class="hs-identifier hs-var">getLoc</span></a></span><span> </span><span class="annot"><span class="annottext">Located Token
</span><a href="#local-6989586621680994959"><span class="hs-identifier hs-var">tok</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-279"></span><span>          </span><span class="annot"><a href="#local-6989586621680994976"><span class="hs-identifier hs-var">parseLanguage</span></a></span><span> </span><span class="hs-special">[</span><span class="hs-special">]</span><span>
</span><span id="line-280"></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [Located String]
forall a. String -&gt; a
</span><a href="GHC.Utils.Panic.Plain.html#panic"><span class="hs-identifier hs-var">panic</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;getOptions'.parseLanguage(2) went past eof token&quot;</span></span><span>
</span><span id="line-281"></span><span>
</span><span id="line-282"></span><span>          </span><span class="annot"><a href="#local-6989586621680994973"><span class="hs-identifier hs-type">isComment</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Parser.Lexer.html#Token"><span class="hs-identifier hs-type">Token</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="hs-identifier hs-type">Bool</span></span><span>
</span><span id="line-283"></span><span>          </span><span id="local-6989586621680994973"><span class="annot"><span class="annottext">isComment :: Token -&gt; Bool
</span><a href="#local-6989586621680994973"><span class="hs-identifier hs-var hs-var">isComment</span></a></span></span><span> </span><span id="local-6989586621680994958"><span class="annot"><span class="annottext">Token
</span><a href="#local-6989586621680994958"><span class="hs-identifier hs-var">c</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-284"></span><span>            </span><span class="hs-keyword">case</span><span> </span><span class="annot"><span class="annottext">Token
</span><a href="#local-6989586621680994958"><span class="hs-identifier hs-var">c</span></a></span><span> </span><span class="hs-keyword">of</span><span>
</span><span id="line-285"></span><span>              </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.Lexer.html#ITlineComment"><span class="hs-identifier hs-type">ITlineComment</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>     </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-286"></span><span>              </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.Lexer.html#ITblockComment"><span class="hs-identifier hs-type">ITblockComment</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>    </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-287"></span><span>              </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.Lexer.html#ITdocCommentNext"><span class="hs-identifier hs-type">ITdocCommentNext</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-288"></span><span>              </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.Lexer.html#ITdocCommentPrev"><span class="hs-identifier hs-type">ITdocCommentPrev</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>  </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-289"></span><span>              </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.Lexer.html#ITdocCommentNamed"><span class="hs-identifier hs-type">ITdocCommentNamed</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-290"></span><span>              </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Parser.Lexer.html#ITdocSection"><span class="hs-identifier hs-type">ITdocSection</span></a></span><span> </span><span class="hs-special">{</span><span class="hs-special">}</span><span class="hs-special">)</span><span>      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">True</span></span><span>
</span><span id="line-291"></span><span>              </span><span class="annot"><span class="annottext">Token
</span><span class="hs-identifier">_</span></span><span>                      </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><span class="annottext">Bool
</span><span class="hs-identifier hs-var">False</span></span><span>
</span><span id="line-292"></span><span>
</span><span id="line-293"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-294"></span><span>
</span><span id="line-295"></span><span class="hs-comment">-- | Complain about non-dynamic flags in OPTIONS pragmas.</span><span>
</span><span id="line-296"></span><span class="hs-comment">--</span><span>
</span><span id="line-297"></span><span class="hs-comment">-- Throws a 'SourceError' if the input list is non-empty claiming that the</span><span>
</span><span id="line-298"></span><span class="hs-comment">-- input flags are unknown.</span><span>
</span><span id="line-299"></span><span id="local-6989586621680995223"><span class="annot"><a href="GHC.Parser.Header.html#checkProcessArgsResult"><span class="hs-identifier hs-type">checkProcessArgsResult</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/Control.Monad.IO.Class.html#MonadIO"><span class="hs-identifier hs-type">MonadIO</span></a></span><span> </span><span class="annot"><a href="#local-6989586621680995223"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-glyph">=&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680995223"><span class="hs-identifier hs-type">m</span></a></span><span> </span><span class="hs-special">(</span><span class="hs-special">)</span></span><span>
</span><span id="line-300"></span><span id="checkProcessArgsResult"><span class="annot"><span class="annottext">checkProcessArgsResult :: forall (m :: * -&gt; *).
MonadIO m =&gt;
DynFlags -&gt; [Located String] -&gt; m ()
</span><a href="GHC.Parser.Header.html#checkProcessArgsResult"><span class="hs-identifier hs-var hs-var">checkProcessArgsResult</span></a></span></span><span> </span><span id="local-6989586621680994943"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994943"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680994942"><span class="annot"><span class="annottext">[Located String]
</span><a href="#local-6989586621680994942"><span class="hs-identifier hs-var">flags</span></a></span></span><span>
</span><span id="line-301"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">Bool -&gt; m () -&gt; m ()
forall (f :: * -&gt; *). Applicative f =&gt; Bool -&gt; f () -&gt; f ()
</span><a href="../../base/src/GHC.Base.html#when"><span class="hs-identifier hs-var">when</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">[Located String] -&gt; Bool
forall a. [a] -&gt; Bool
</span><a href="GHC.Utils.Misc.html#notNull"><span class="hs-identifier hs-var">notNull</span></a></span><span> </span><span class="annot"><span class="annottext">[Located String]
</span><a href="#local-6989586621680994942"><span class="hs-identifier hs-var">flags</span></a></span><span class="hs-special">)</span><span> </span><span class="annot"><span class="annottext">(m () -&gt; m ()) -&gt; m () -&gt; m ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-302"></span><span>      </span><span class="annot"><span class="annottext">IO () -&gt; m ()
forall (m :: * -&gt; *) a. MonadIO m =&gt; IO a -&gt; m a
</span><a href="../../base/src/Control.Monad.IO.Class.html#liftIO"><span class="hs-identifier hs-var">liftIO</span></a></span><span> </span><span class="annot"><span class="annottext">(IO () -&gt; m ()) -&gt; IO () -&gt; m ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">SourceError -&gt; IO ()
forall e a. Exception e =&gt; e -&gt; IO a
</span><a href="../../base/src/GHC.IO.html#throwIO"><span class="hs-identifier hs-var">throwIO</span></a></span><span> </span><span class="annot"><span class="annottext">(SourceError -&gt; IO ()) -&gt; SourceError -&gt; IO ()
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ErrorMessages -&gt; SourceError
</span><a href="GHC.Driver.Types.html#mkSrcErr"><span class="hs-identifier hs-var">mkSrcErr</span></a></span><span> </span><span class="annot"><span class="annottext">(ErrorMessages -&gt; SourceError) -&gt; ErrorMessages -&gt; SourceError
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">[ErrMsg] -&gt; ErrorMessages
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span class="annot"><span class="annottext">([ErrMsg] -&gt; ErrorMessages) -&gt; [ErrMsg] -&gt; ErrorMessages
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">(Located String -&gt; ErrMsg) -&gt; [Located String] -&gt; [ErrMsg]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Located String -&gt; ErrMsg
</span><a href="#local-6989586621680994939"><span class="hs-identifier hs-var">mkMsg</span></a></span><span> </span><span class="annot"><span class="annottext">[Located String]
</span><a href="#local-6989586621680994942"><span class="hs-identifier hs-var">flags</span></a></span><span>
</span><span id="line-303"></span><span>    </span><span class="hs-keyword">where</span><span> </span><span id="local-6989586621680994939"><span class="annot"><span class="annottext">mkMsg :: Located String -&gt; ErrMsg
</span><a href="#local-6989586621680994939"><span class="hs-identifier hs-var hs-var">mkMsg</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680994938"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994938"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621680994937"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994937"><span class="hs-identifier hs-var">flag</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-304"></span><span>              </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SrcSpan -&gt; MsgDoc -&gt; ErrMsg
</span><a href="GHC.Utils.Error.html#mkPlainErrMsg"><span class="hs-identifier hs-var">mkPlainErrMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994943"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994938"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; ErrMsg) -&gt; MsgDoc -&gt; ErrMsg
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-305"></span><span>                  </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;unknown flag in  {-# OPTIONS_GHC #-} pragma:&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span>
</span><span id="line-306"></span><span>                   </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994937"><span class="hs-identifier hs-var">flag</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-307"></span><span>
</span><span id="line-308"></span><span class="hs-comment">-----------------------------------------------------------------------------</span><span>
</span><span id="line-309"></span><span>
</span><span id="line-310"></span><span class="annot"><a href="GHC.Parser.Header.html#checkExtension"><span class="hs-identifier hs-type">checkExtension</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="GHC.Data.FastString.html#FastString"><span class="hs-identifier hs-type">FastString</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span>
</span><span id="line-311"></span><span id="checkExtension"><span class="annot"><span class="annottext">checkExtension :: DynFlags -&gt; Located FastString -&gt; Located String
</span><a href="GHC.Parser.Header.html#checkExtension"><span class="hs-identifier hs-var hs-var">checkExtension</span></a></span></span><span> </span><span id="local-6989586621680994933"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994933"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680994932"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994932"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621680994931"><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621680994931"><span class="hs-identifier hs-var">ext</span></a></span></span><span class="hs-special">)</span><span>
</span><span id="line-312"></span><span class="hs-comment">-- Checks if a given extension is valid, and if so returns</span><span>
</span><span id="line-313"></span><span class="hs-comment">-- its corresponding flag. Otherwise it throws an exception.</span><span>
</span><span id="line-314"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994930"><span class="hs-identifier hs-var">ext'</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; Bool
forall (t :: * -&gt; *) a. (Foldable t, Eq a) =&gt; a -&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#elem"><span class="hs-operator hs-var">`elem`</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680994928"><span class="hs-identifier hs-var">supported</span></a></span><span>
</span><span id="line-315"></span><span>    </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; String -&gt; Located String
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994932"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;-X&quot;</span></span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994930"><span class="hs-identifier hs-var">ext'</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-316"></span><span>    </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SrcSpan -&gt; String -&gt; Located String
forall a. DynFlags -&gt; SrcSpan -&gt; String -&gt; a
</span><a href="GHC.Parser.Header.html#unsupportedExtnError"><span class="hs-identifier hs-var">unsupportedExtnError</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994933"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994932"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994930"><span class="hs-identifier hs-var">ext'</span></a></span><span>
</span><span id="line-317"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-318"></span><span>    </span><span id="local-6989586621680994930"><span class="annot"><span class="annottext">ext' :: String
</span><a href="#local-6989586621680994930"><span class="hs-identifier hs-var hs-var">ext'</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">FastString -&gt; String
</span><a href="GHC.Data.FastString.html#unpackFS"><span class="hs-identifier hs-var">unpackFS</span></a></span><span> </span><span class="annot"><span class="annottext">FastString
</span><a href="#local-6989586621680994931"><span class="hs-identifier hs-var">ext</span></a></span><span>
</span><span id="line-319"></span><span>    </span><span id="local-6989586621680994928"><span class="annot"><span class="annottext">supported :: [String]
</span><a href="#local-6989586621680994928"><span class="hs-identifier hs-var hs-var">supported</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PlatformMini -&gt; [String]
</span><a href="GHC.Driver.Session.html#supportedLanguagesAndExtensions"><span class="hs-identifier hs-var">supportedLanguagesAndExtensions</span></a></span><span> </span><span class="annot"><span class="annottext">(PlatformMini -&gt; [String]) -&gt; PlatformMini -&gt; [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Platform -&gt; PlatformMini
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformMini"><span class="hs-identifier hs-var hs-var">platformMini</span></a></span><span> </span><span class="annot"><span class="annottext">(Platform -&gt; PlatformMini) -&gt; Platform -&gt; PlatformMini
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994933"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-320"></span><span>
</span><span id="line-321"></span><span id="local-6989586621680995225"><span class="annot"><a href="GHC.Parser.Header.html#languagePragParseError"><span class="hs-identifier hs-type">languagePragParseError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680995225"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-322"></span><span id="languagePragParseError"><span class="annot"><span class="annottext">languagePragParseError :: forall a. DynFlags -&gt; SrcSpan -&gt; a
</span><a href="GHC.Parser.Header.html#languagePragParseError"><span class="hs-identifier hs-var hs-var">languagePragParseError</span></a></span></span><span> </span><span id="local-6989586621680994922"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994922"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680994921"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994921"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-323"></span><span>    </span><span class="annot"><span class="annottext">DynFlags -&gt; SrcSpan -&gt; MsgDoc -&gt; a
forall a. DynFlags -&gt; SrcSpan -&gt; MsgDoc -&gt; a
</span><a href="GHC.Parser.Header.html#throwErr"><span class="hs-identifier hs-var">throwErr</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994922"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994921"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; a) -&gt; MsgDoc -&gt; a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-324"></span><span>       </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Cannot parse LANGUAGE pragma&quot;</span></span><span>
</span><span id="line-325"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Expecting comma-separated list of language options,&quot;</span></span><span>
</span><span id="line-326"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;each starting with a capital letter&quot;</span></span><span>
</span><span id="line-327"></span><span>            </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">Int -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#nest"><span class="hs-identifier hs-var">nest</span></a></span><span> </span><span class="annot"><span class="annottext">Int
</span><span class="hs-number">2</span></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;E.g. {-# LANGUAGE TemplateHaskell, GADTs #-}&quot;</span></span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-328"></span><span>
</span><span id="line-329"></span><span id="local-6989586621680995212"><span class="annot"><a href="GHC.Parser.Header.html#unsupportedExtnError"><span class="hs-identifier hs-type">unsupportedExtnError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680995212"><span class="hs-identifier hs-type">a</span></a></span></span><span>
</span><span id="line-330"></span><span id="unsupportedExtnError"><span class="annot"><span class="annottext">unsupportedExtnError :: forall a. DynFlags -&gt; SrcSpan -&gt; String -&gt; a
</span><a href="GHC.Parser.Header.html#unsupportedExtnError"><span class="hs-identifier hs-var hs-var">unsupportedExtnError</span></a></span></span><span> </span><span id="local-6989586621680994916"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994916"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680994915"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994915"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621680994914"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994914"><span class="hs-identifier hs-var">unsup</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-331"></span><span>    </span><span class="annot"><span class="annottext">DynFlags -&gt; SrcSpan -&gt; MsgDoc -&gt; a
forall a. DynFlags -&gt; SrcSpan -&gt; MsgDoc -&gt; a
</span><a href="GHC.Parser.Header.html#throwErr"><span class="hs-identifier hs-var">throwErr</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994916"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994915"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; a) -&gt; MsgDoc -&gt; a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-332"></span><span>        </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Unsupported extension: &quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%3E"><span class="hs-operator hs-var">&lt;&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994914"><span class="hs-identifier hs-var">unsup</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%24%24"><span class="hs-operator hs-var">$$</span></a></span><span>
</span><span id="line-333"></span><span>        </span><span class="hs-keyword">if</span><span> </span><span class="annot"><span class="annottext">[String] -&gt; Bool
forall (t :: * -&gt; *) a. Foldable t =&gt; t a -&gt; Bool
</span><a href="../../base/src/Data.Foldable.html#null"><span class="hs-identifier hs-var">null</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680994910"><span class="hs-identifier hs-var">suggestions</span></a></span><span> </span><span class="hs-keyword">then</span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="GHC.Utils.Outputable.html#empty"><span class="hs-identifier hs-var">Outputable.empty</span></a></span><span> </span><span class="hs-keyword">else</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Perhaps you meant&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#quotedListWithOr"><span class="hs-identifier hs-var">quotedListWithOr</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(String -&gt; MsgDoc) -&gt; [String] -&gt; [MsgDoc]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680994910"><span class="hs-identifier hs-var">suggestions</span></a></span><span class="hs-special">)</span><span>
</span><span id="line-334"></span><span>  </span><span class="hs-keyword">where</span><span>
</span><span id="line-335"></span><span>     </span><span id="local-6989586621680994907"><span class="annot"><span class="annottext">supported :: [String]
</span><a href="#local-6989586621680994907"><span class="hs-identifier hs-var hs-var">supported</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">PlatformMini -&gt; [String]
</span><a href="GHC.Driver.Session.html#supportedLanguagesAndExtensions"><span class="hs-identifier hs-var">supportedLanguagesAndExtensions</span></a></span><span> </span><span class="annot"><span class="annottext">(PlatformMini -&gt; [String]) -&gt; PlatformMini -&gt; [String]
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">Platform -&gt; PlatformMini
</span><a href="../../ghc-boot/src/GHC.Platform.html#platformMini"><span class="hs-identifier hs-var hs-var">platformMini</span></a></span><span> </span><span class="annot"><span class="annottext">(Platform -&gt; PlatformMini) -&gt; Platform -&gt; PlatformMini
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; Platform
</span><a href="GHC.Driver.Session.html#targetPlatform"><span class="hs-identifier hs-var hs-var">targetPlatform</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994916"><span class="hs-identifier hs-var">dflags</span></a></span><span>
</span><span id="line-336"></span><span>     </span><span id="local-6989586621680994910"><span class="annot"><span class="annottext">suggestions :: [String]
</span><a href="#local-6989586621680994910"><span class="hs-identifier hs-var hs-var">suggestions</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="annot"><span class="annottext">String -&gt; [String] -&gt; [String]
</span><a href="GHC.Utils.Misc.html#fuzzyMatch"><span class="hs-identifier hs-var">fuzzyMatch</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994914"><span class="hs-identifier hs-var">unsup</span></a></span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680994907"><span class="hs-identifier hs-var">supported</span></a></span><span>
</span><span id="line-337"></span><span>
</span><span id="line-338"></span><span>
</span><span id="line-339"></span><span class="annot"><a href="GHC.Parser.Header.html#optionsErrorMsgs"><span class="hs-identifier hs-type">optionsErrorMsgs</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="../../base/src/GHC.IO.html#FilePath"><span class="hs-identifier hs-type">FilePath</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Error.html#Messages"><span class="hs-identifier hs-type">Messages</span></a></span><span>
</span><span id="line-340"></span><span id="optionsErrorMsgs"><span class="annot"><span class="annottext">optionsErrorMsgs :: DynFlags
-&gt; [String]
-&gt; [Located String]
-&gt; String
-&gt; (ErrorMessages, ErrorMessages)
</span><a href="GHC.Parser.Header.html#optionsErrorMsgs"><span class="hs-identifier hs-var hs-var">optionsErrorMsgs</span></a></span></span><span> </span><span id="local-6989586621680994904"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994904"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680994903"><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680994903"><span class="hs-identifier hs-var">unhandled_flags</span></a></span></span><span> </span><span id="local-6989586621680994902"><span class="annot"><span class="annottext">[Located String]
</span><a href="#local-6989586621680994902"><span class="hs-identifier hs-var">flags_lines</span></a></span></span><span> </span><span id="local-6989586621680994901"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994901"><span class="hs-identifier hs-var">_filename</span></a></span></span><span>
</span><span id="line-341"></span><span>  </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">ErrorMessages
forall a. Bag a
</span><a href="GHC.Data.Bag.html#emptyBag"><span class="hs-identifier hs-var">emptyBag</span></a></span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">[ErrMsg] -&gt; ErrorMessages
forall a. [a] -&gt; Bag a
</span><a href="GHC.Data.Bag.html#listToBag"><span class="hs-identifier hs-var">listToBag</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">(Located String -&gt; ErrMsg) -&gt; [Located String] -&gt; [ErrMsg]
forall a b. (a -&gt; b) -&gt; [a] -&gt; [b]
</span><a href="../../base/src/GHC.Base.html#map"><span class="hs-identifier hs-var">map</span></a></span><span> </span><span class="annot"><span class="annottext">Located String -&gt; ErrMsg
</span><a href="#local-6989586621680994900"><span class="hs-identifier hs-var">mkMsg</span></a></span><span> </span><span class="annot"><span class="annottext">[Located String]
</span><a href="#local-6989586621680994899"><span class="hs-identifier hs-var">unhandled_flags_lines</span></a></span><span class="hs-special">)</span><span class="hs-special">)</span><span>
</span><span id="line-342"></span><span>  </span><span class="hs-keyword">where</span><span> </span><span class="annot"><a href="#local-6989586621680994899"><span class="hs-identifier hs-type">unhandled_flags_lines</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="hs-special">[</span><span class="annot"><a href="GHC.Types.SrcLoc.html#Located"><span class="hs-identifier hs-type">Located</span></a></span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span class="hs-special">]</span><span>
</span><span id="line-343"></span><span>        </span><span id="local-6989586621680994899"><span class="annot"><span class="annottext">unhandled_flags_lines :: [Located String]
</span><a href="#local-6989586621680994899"><span class="hs-identifier hs-var hs-var">unhandled_flags_lines</span></a></span></span><span> </span><span class="hs-glyph">=</span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">SrcSpan -&gt; String -&gt; Located String
forall l e. l -&gt; e -&gt; GenLocated l e
</span><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-var">L</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994898"><span class="hs-identifier hs-var">l</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994897"><span class="hs-identifier hs-var">f</span></a></span><span>
</span><span id="line-344"></span><span>                                </span><span class="hs-glyph">|</span><span> </span><span id="local-6989586621680994897"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994897"><span class="hs-identifier hs-var">f</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[String]
</span><a href="#local-6989586621680994903"><span class="hs-identifier hs-var">unhandled_flags</span></a></span><span>
</span><span id="line-345"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680994898"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994898"><span class="hs-identifier hs-var">l</span></a></span></span><span> </span><span id="local-6989586621680994896"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994896"><span class="hs-identifier hs-var">f'</span></a></span></span><span> </span><span class="hs-glyph">&lt;-</span><span> </span><span class="annot"><span class="annottext">[Located String]
</span><a href="#local-6989586621680994902"><span class="hs-identifier hs-var">flags_lines</span></a></span><span>
</span><span id="line-346"></span><span>                                </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994897"><span class="hs-identifier hs-var">f</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; Bool
forall a. Eq a =&gt; a -&gt; a -&gt; Bool
</span><span class="hs-operator hs-var">==</span></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994896"><span class="hs-identifier hs-var">f'</span></a></span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-347"></span><span>        </span><span id="local-6989586621680994900"><span class="annot"><span class="annottext">mkMsg :: Located String -&gt; ErrMsg
</span><a href="#local-6989586621680994900"><span class="hs-identifier hs-var hs-var">mkMsg</span></a></span></span><span> </span><span class="hs-special">(</span><span class="annot"><a href="GHC.Types.SrcLoc.html#L"><span class="hs-identifier hs-type">L</span></a></span><span> </span><span id="local-6989586621680994895"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994895"><span class="hs-identifier hs-var">flagSpan</span></a></span></span><span> </span><span id="local-6989586621680994894"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994894"><span class="hs-identifier hs-var">flag</span></a></span></span><span class="hs-special">)</span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-348"></span><span>            </span><span class="annot"><span class="annottext">DynFlags -&gt; SrcSpan -&gt; MsgDoc -&gt; ErrMsg
</span><a href="GHC.Utils.Error.html#mkPlainErrMsg"><span class="hs-identifier hs-var">GHC.Utils.Error.mkPlainErrMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994904"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994895"><span class="hs-identifier hs-var">flagSpan</span></a></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; ErrMsg) -&gt; MsgDoc -&gt; ErrMsg
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-349"></span><span>                    </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;unknown flag in  {-# OPTIONS_GHC #-} pragma:&quot;</span></span><span> </span><span class="annot"><span class="annottext">MsgDoc -&gt; MsgDoc -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#%3C%2B%3E"><span class="hs-operator hs-var">&lt;+&gt;</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994894"><span class="hs-identifier hs-var">flag</span></a></span><span>
</span><span id="line-350"></span><span>
</span><span id="line-351"></span><span id="local-6989586621680995228"><span class="annot"><a href="GHC.Parser.Header.html#optionsParseError"><span class="hs-identifier hs-type">optionsParseError</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="../../base/src/GHC.Base.html#String"><span class="hs-identifier hs-type">String</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680995228"><span class="hs-identifier hs-type">a</span></a></span></span><span>     </span><span class="hs-comment">-- #15053</span><span>
</span><span id="line-352"></span><span id="optionsParseError"><span class="annot"><span class="annottext">optionsParseError :: forall a. String -&gt; DynFlags -&gt; SrcSpan -&gt; a
</span><a href="GHC.Parser.Header.html#optionsParseError"><span class="hs-identifier hs-var hs-var">optionsParseError</span></a></span></span><span> </span><span id="local-6989586621680994889"><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994889"><span class="hs-identifier hs-var">str</span></a></span></span><span> </span><span id="local-6989586621680994888"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994888"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680994887"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994887"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-353"></span><span>  </span><span class="annot"><span class="annottext">DynFlags -&gt; SrcSpan -&gt; MsgDoc -&gt; a
forall a. DynFlags -&gt; SrcSpan -&gt; MsgDoc -&gt; a
</span><a href="GHC.Parser.Header.html#throwErr"><span class="hs-identifier hs-var">throwErr</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994888"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994887"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">(MsgDoc -&gt; a) -&gt; MsgDoc -&gt; a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span>
</span><span id="line-354"></span><span>      </span><span class="annot"><span class="annottext">[MsgDoc] -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#vcat"><span class="hs-identifier hs-var">vcat</span></a></span><span> </span><span class="hs-special">[</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Error while parsing OPTIONS_GHC pragma.&quot;</span></span><span>
</span><span id="line-355"></span><span>           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Expecting whitespace-separated list of GHC options.&quot;</span></span><span>
</span><span id="line-356"></span><span>           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;  E.g. {-# OPTIONS_GHC -Wall -O2 #-}&quot;</span></span><span>
</span><span id="line-357"></span><span>           </span><span class="hs-special">,</span><span> </span><span class="annot"><span class="annottext">String -&gt; MsgDoc
</span><a href="GHC.Utils.Outputable.html#text"><span class="hs-identifier hs-var">text</span></a></span><span> </span><span class="hs-special">(</span><span class="annot"><span class="annottext">String
</span><span class="hs-string">&quot;Input was: &quot;</span></span><span> </span><span class="annot"><span class="annottext">String -&gt; String -&gt; String
forall a. [a] -&gt; [a] -&gt; [a]
</span><a href="../../base/src/GHC.Base.html#%2B%2B"><span class="hs-operator hs-var">++</span></a></span><span> </span><span class="annot"><span class="annottext">String -&gt; String
forall a. Show a =&gt; a -&gt; String
</span><a href="../../base/src/GHC.Show.html#show"><span class="hs-identifier hs-var">show</span></a></span><span> </span><span class="annot"><span class="annottext">String
</span><a href="#local-6989586621680994889"><span class="hs-identifier hs-var">str</span></a></span><span class="hs-special">)</span><span> </span><span class="hs-special">]</span><span>
</span><span id="line-358"></span><span>
</span><span id="line-359"></span><span id="local-6989586621680995208"><span class="annot"><a href="GHC.Parser.Header.html#throwErr"><span class="hs-identifier hs-type">throwErr</span></a></span><span> </span><span class="hs-glyph">::</span><span> </span><span class="annot"><a href="GHC.Driver.Session.html#DynFlags"><span class="hs-identifier hs-type">DynFlags</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Types.SrcLoc.html#SrcSpan"><span class="hs-identifier hs-type">SrcSpan</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="GHC.Utils.Outputable.html#SDoc"><span class="hs-identifier hs-type">SDoc</span></a></span><span> </span><span class="hs-glyph">-&gt;</span><span> </span><span class="annot"><a href="#local-6989586621680995208"><span class="hs-identifier hs-type">a</span></a></span></span><span>                </span><span class="hs-comment">-- #15053</span><span>
</span><span id="line-360"></span><span id="throwErr"><span class="annot"><span class="annottext">throwErr :: forall a. DynFlags -&gt; SrcSpan -&gt; MsgDoc -&gt; a
</span><a href="GHC.Parser.Header.html#throwErr"><span class="hs-identifier hs-var hs-var">throwErr</span></a></span></span><span> </span><span id="local-6989586621680994883"><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994883"><span class="hs-identifier hs-var">dflags</span></a></span></span><span> </span><span id="local-6989586621680994882"><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994882"><span class="hs-identifier hs-var">loc</span></a></span></span><span> </span><span id="local-6989586621680994881"><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621680994881"><span class="hs-identifier hs-var">doc</span></a></span></span><span> </span><span class="hs-glyph">=</span><span>
</span><span id="line-361"></span><span>  </span><span class="annot"><span class="annottext">SourceError -&gt; a
forall a e. Exception e =&gt; e -&gt; a
</span><a href="../../base/src/GHC.Exception.html#throw"><span class="hs-identifier hs-var">throw</span></a></span><span> </span><span class="annot"><span class="annottext">(SourceError -&gt; a) -&gt; SourceError -&gt; a
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ErrorMessages -&gt; SourceError
</span><a href="GHC.Driver.Types.html#mkSrcErr"><span class="hs-identifier hs-var">mkSrcErr</span></a></span><span> </span><span class="annot"><span class="annottext">(ErrorMessages -&gt; SourceError) -&gt; ErrorMessages -&gt; SourceError
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">ErrMsg -&gt; ErrorMessages
forall a. a -&gt; Bag a
</span><a href="GHC.Data.Bag.html#unitBag"><span class="hs-identifier hs-var">unitBag</span></a></span><span> </span><span class="annot"><span class="annottext">(ErrMsg -&gt; ErrorMessages) -&gt; ErrMsg -&gt; ErrorMessages
forall a b. (a -&gt; b) -&gt; a -&gt; b
</span><a href="../../base/src/GHC.Base.html#%24"><span class="hs-operator hs-var">$</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags -&gt; SrcSpan -&gt; MsgDoc -&gt; ErrMsg
</span><a href="GHC.Utils.Error.html#mkPlainErrMsg"><span class="hs-identifier hs-var">mkPlainErrMsg</span></a></span><span> </span><span class="annot"><span class="annottext">DynFlags
</span><a href="#local-6989586621680994883"><span class="hs-identifier hs-var">dflags</span></a></span><span> </span><span class="annot"><span class="annottext">SrcSpan
</span><a href="#local-6989586621680994882"><span class="hs-identifier hs-var">loc</span></a></span><span> </span><span class="annot"><span class="annottext">MsgDoc
</span><a href="#local-6989586621680994881"><span class="hs-identifier hs-var">doc</span></a></span><span>
</span><span id="line-362"></span></pre></body></html>